Latex en la leyenda de los graficos

15 Ansichten (letzte 30 Tage)
Mauro Gonzalez
Mauro Gonzalez am 10 Mai 2023
Bearbeitet: VBBV am 10 Mai 2023
¿Por que la leyenda del grafico no me toma la fuente de latex?
x=[0:0.02:1];
u1=0.13-1.37.*x+1.9.*x.^2-1.11.*x.^3-0.88.*x.^4;
u2=0.13-1.46.*x+0.09.*x.*(1-x)+1.99.*x.^2.*(1-x)+0.88.*x.^3.*(1-x);
plot(x,u1);
hold on;
grid on;
plot(x,u2,'k--');
legend('u','\hat{u}','interpreter','latex');
xlabel('$x$','interpreter','latex')
ylabel('$u \hspace{3mm} \hat{u}$','interpreter','latex')
Warning: Error updating Legend.

String scalar or character vector must have valid interpreter syntax:
\hat{u}

Antworten (2)

Walter Roberson
Walter Roberson am 10 Mai 2023
'$\hat{u}$'

VBBV
VBBV am 10 Mai 2023
Bearbeitet: VBBV am 10 Mai 2023
you can use the $\hat{u}$ in legend function , The latex interpreter fonts usually appear smaller compared to regular fontsize.
x=[0:0.02:1];
u1=0.13-1.37.*x+1.9.*x.^2-1.11.*x.^3-0.88.*x.^4;
u2=0.13-1.46.*x+0.09.*x.*(1-x)+1.99.*x.^2.*(1-x)+0.88.*x.^3.*(1-x);
plot(x,u1);
hold on;
grid on;
plot(x,u2,'k--');
%
legend('u','$\hat{u}$','interpreter','latex','fontsize',18)
xlabel('$x$','interpreter','latex','fontsize',18)
ylabel('[$u ,\hspace{3mm} \hat{u}$]','interpreter','latex','fontsize',18)

Kategorien

Mehr zu Labels and Annotations finden Sie in Help Center und File Exchange

Produkte


Version

R2016b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by