Greek letters Latex interpreter

조회 수: 15 (최근 30일)
Francesco Marchione
Francesco Marchione 2021년 7월 23일
답변: Rik 2021년 7월 23일
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.

채택된 답변

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Labels and Annotations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by