set(h1,'String','$l_1$','Interpreter','LaTex');
---------------------------如何在matlab中的xlabel,ylabel,legend和text函数中使用latex(
以下关于legend的不必看,已到我的例二)---------------------------
http://blog.sina.com.cn/s/blog_6e0693f70100nj22.html
以下例子中展示了如何用在matlab函数中使用latex
t = 0:0.1:2*pi;
x = sin(t);
hold on;
plot(t,x,'-*');
plot(t,2*x,'-.');
%% Using Latex in xlabel and ylabel
xlabel('$Time$','Interpreter','LaTex');
ylabel('$Value$','Interpreter','LaTex');
%% Using Latex in legend
h = legend('sin(x)__','2*sin(x)__');
h1 = findobj(get(h,'Children'),'String','sin(x)__');
set(h1,'String','$sin(\hat{x})$','Interpreter','LaTex');
h2 = findobj(get(h,'Children'),'String','2*sin(x)__');
set(h2,'String','$2*sin(\hat{x})$','Interpreter','LaTex');
%% Using Latex in text
text('Interpreter','latex',...
'String','$$\int_0^x\!\int_y dF(u,v)$$',...
'Position',[3 1],...
'FontSize',16);
%% Using Latex in title
title('$How \ to \ use \ latex \ in \ figure$','Interpreter','LaTex');