Try with Latex interpreter, something like
legend({'$b^{+6}\rightarrow b^{+7}$'}, 'interpreter', 'latex')
Tested under R2012a:
Question
My matlab does not accept my latex . For example if I use legend('b^{+6}\rightarrow b^{+7}')
, it does not show me the arrow, How I can solve the problem?
No correct solution
OTHER TIPS
Try with Latex interpreter, something like
legend({'$b^{+6}\rightarrow b^{+7}$'}, 'interpreter', 'latex')
Tested under R2012a:
In my case I had to set the latex interpreter after the legend command:
l = legend({'$b^{+6}\rightarrow b^{+7}$'})
set(l, 'Interpreter', 'Latex');
This worked in Matlab R2016b
For xlabel
and ylabel
, simply use something like:
xlabel( ' $\Delta t$ [ sec ] ','Interpreter','latex')
For some reason, Matlab has more difficulty with legends; you have to set the interpreter after the legend has been created:
legend_handle = legend('$b^{+6}\rightarrow b^{+7}$');
set(legend_handle,'Interpreter','latex')
if the comand... l = legend({'$b^{+6}\rightarrow b^{+7}$'}) set(l, 'Interpreter', 'Latex'); dosn't work. Try to put "hold on" after the "set" instruction".