The following example illustrates how to:
(1) Put an overbar over the text string, "5*pi/4", using "\overline" option.
(2) Evaluate an expression within the TEXT command. In this case, the value of "sin(5*pi/4)" will be evaluated and displayed.
figure
plot(0:pi/20:2*pi,sin(0:pi/20:2*pi))
text('interpreter','latex','string',['$sin(\overline {5*pi/4} ) = ',num2str(sin(5*pi/4)),'$'],...
'FontSize',16)
Similarly, to display this line in the title, (or xlabel or ylabel), use,
title(['$sin(\overline {5*pi/4} ) = ',num2str(sin(5*pi/4)),'$'],'interpreter','latex','FontSize',16)
where the command TITLE can be swapped out with XLABEL or YLABEL directly.
Best Answer