MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today
Asked by Shah on 22 Nov 2011

I am plotting some data which includes estimates of some parameters. I want to describe the estimates by using \hat on the parameter symbols. This I have o do in legends and axis labels fields. I could not fix this matter despite some experiments using information from MATLAB help. Any idea, please to fix this problem.

I really appreciate help on this matter which will improve the look of my presentation.

Shah

*No products are associated with this question.*

Answer by Frederik van der Walt on 4 Apr 2012

l= legend(['$\hat{\psi}$']);

set(l,'Interpreter','Latex');

Answer by Steven on 22 Nov 2011

Try with Latex interpreter, something like

title(['$ latex $'],'interpreter','latex')

Answer by Shah on 23 Nov 2011

......... Its done! Actually, the default interpreter in MATLAB for legend is 'tex', I guess. It is not changed from the code line. What I had to do was to right click on the legend in the figure window and then changed the 'interpreter' from 'tex' to 'latex'. This action changed the latex statement in the legend field to Math mode.

Cheers Shah

Answer by Matthew Simoneau on 30 May 2014

To use the full LaTeX interpreter, you can specify it as a parameter:

title('$\hat{\psi}$','Interpreter','latex')

Note that for `legend`, you need to use pass in you labels as a cell array to distinguish them from the parameters:

plot(1:10) legend({'$\hat{\psi}$'},'Interpreter','latex')

## 0 Comments