MATLAB: How to put latex in Xtick label? (Matlab 2015b)

xtick plot figure

How can I have latex \mu and \mu_2 on the dotted lines Xtick? No other Xtick is necessary.
clc;
clear all;
mu=0;
mu2=4;
sigma=1;
x=linspace(mu-4*sigma, mu+4*sigma, 10000);
x2=linspace(mu2-4*sigma, mu2+4*sigma, 10000);
m_x = [mu mu2];
m_y = [0 0];
figure;
set(gcf,'units','inches','renderer', 'painters');
pos = get(gcf,'pos');
set(gcf,'Units','inches',...
'Position',[pos(1) pos(2) 3.5 2]);plot(x, normpdf (x,mu,sigma),'blue');
hold all;
plot(x2, normpdf (x2,mu2,sigma),'green');
plot(m_x, m_y,'red','LineWidth',3);
yL=get(gca,'YLim');
SP=0;
SP2=4;
line([SP SP],yL,'color','k','LineStyle',':');
line([SP2 SP2],yL,'color','k','LineStyle',':');
hold off

Best Answer

I don’t see where you’re defining them, but to invoke the LaTeX interpreter, use the name-value pair 'Interpreter','latex' in whatever call you want to use it in.