没有出现LaTeX的Matlab图标题?

时间:2016-04-04 23:59:24

标签: matlab latex title matlab-figure interpreter

我正在尝试使用LaTeX标记我的情节。我有两个问题:我的标题不会显示,我需要在LaTeX表达式中添加文本。理想情况下,我希望它为n"的不同值标记我的数字" f(x),而不是" f(x)"我想要这个:

LaTeX Expression

如何为n"的不同值添加"我的LaTeX表达的一部分,更重要的是,为什么我的标题首先出现?

这是我的剧本:

x = linspace(0, 1, 100);
y1 = sin(pi*x);
y2 = sin(2*pi*x);
y3 = sin(4*pi*x);
hold on
plot(x,y1,'color',1/255*[255 20 147],'LineWidth',2);
plot(x,y2,'color',1/255*[0 238 118],'LineWidth',2);
plot(x,y3,'color',1/255*[0 238 238],'LineWidth',2);
xlabel('\theta','FontSize',15);
ylabel('$f_{s}(\theta)$','Interpreter','LaTex','FontSize',15);
title('$f_{s}(\theta)=\sin (n\theta\pi)$','Interpreter','LaTex',FontSize',18);
legend('n = 1', 'n = 2', 'n = 4','Location','best')
hold off

1 个答案:

答案 0 :(得分:2)

基本上,在FontSize失踪之前只有一个开头的撇号。然后,标题确实出现了。要添加非数学文本,只需在$符号后继续。

title('$f_{s}(\theta)=\sin (n\theta\pi)$  for different values of n','Interpreter','LaTex','FontSize',18);