Greek letters Latex interpreter

15 views (last 30 days)
Francesco Marchione
Francesco Marchione on 23 Jul 2021
Answered: Rik on 23 Jul 2021
I have the following code to plot the 2D graph:
T1 = readtable('PROVA GRAFICI.xlsx', 'VariableNamingRule','preserve')
figure
plot(T1.('x/L'), T1.('tau (MPa)'), '-r', T1.('x/L_1'), T1.('tau (MPa)_1'),':k',T1.('x/L_2'), T1.('tau (MPa)_2'),'k', 'LineWidth',0.7)
grid
xlim([-1 1])
ylim([-6 6])
ylabelname = sprintf('Load [N]','${D_{i}}$' );
ylabel(ylabelname, 'fontsize', 11, 'interpreter', 'latex')
set(gca,'xticklabel',num2str(get(gca,'xtick')','%.2f'))
L=legend('ADH1','ADH2','ADH3', 'Location','best');
set(L,'Interpreter','latex')
set(gca,'TickLabelInterpreter','latex')
xlabel(sprintf('Displacement [mm]','${D_{i}}$'), 'Interpreter','latex')
ylabel(sprintf('Shear stress [MPa]','${D_{i}}$'), 'Interpreter','latex')
In the y axis, I would like to write tau instead of "Shear stress", using LaTeX interpreter. I do not know hot to do this.
Could you help me please?
Thank you.

Accepted Answer

Rik
Rik on 23 Jul 2021
You need to turn math mode on:
plot(rand(10,2));
ylabel('Shear stress $\tau$ [MPa]', 'fontsize', 11, 'interpreter', 'latex')

More Answers (0)

Categories

Find more on Labels and Annotations in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!