Legends in Bode plots do not support subscripts

조회 수: 26 (최근 30일)
Thomas Alberts
Thomas Alberts 2023년 3월 5일
댓글: Thomas Alberts 2023년 3월 5일
The same command that correctly put subscripts in legend in plot does not work for bode. This is not an issue in title. Using the LaTeX interpereter does not help.
g1=tf([R1*C1 0],[ R1*C1 1]);
bode(g1)
legend('\Gamma_h')
title('\Gamma_h vs \omega')

답변 (1개)

Askic V
Askic V 2023년 3월 5일
편집: Askic V 2023년 3월 5일
g1=tf([1 0],[5 1]);
bode(g1)
title('\Gamma_h vs \omega')
h = legend('$\Gamma\_h$','fontsize', 12);
set(h, 'Interpreter', 'latex');
I believe this is a bug that was reported in earlier versions. What do you mean by Latex doesn't help?
  댓글 수: 1
Thomas Alberts
Thomas Alberts 2023년 3월 5일
2022B
Funny thing is, using
h = legend('$\Gamma\_h$','fontsize', 12);
set(h, 'Interpreter', 'latex');
Worked for my figure and the example I gave you, but then when I try what I really want to do, it fails.
% Bandstop RC
R1=1000e3;
% R1=3e3;
R2=100;
% R2=2e3;
C1=100e-9;
C2=100e-9;
f1=1/(R1*C1);
f2=1/(R2*C2);
fm=sqrt(f1*f2);
% g=tf(R2*C2*[1 0],[R1*R2*C1*C2 R2*C2+(C1+C2)*R1 1])
g=tf([R1*C1*R2*C2 R1*C1+R2*C2 1],[R1*R2*C1*C2 R2*C2+(C1+C2)*R1 1])
g1=tf([R1*C1 0],[ R1*C1 1]);
g2=tf([1],[ R2*C2 1]);
p = bodeoptions('cstprefs'); % Set options
p.FreqUnits = 'Hz';
p.PhaseVisible = 'off';
figure
h=bodeplot(g,p);
xx=getoptions(h,'xlim');
hold
bodeplot(g1)
bodeplot(g2)
bodeplot(g1,f1,'*')
bodeplot(g2,f2,'*g')
bodeplot(g,fm,'*r')
xlim(xx{:})
ylim([-10 0])
grid
hold off
h=legend('$Highpass$','$Lowpass$','$Bandstop$','$f_{l}$','$f_{h}$','$f_{m}$', ...
'fontsize',10);
set(h, 'Interpreter', 'latex');
Also, I don't understand why we should have to go to the trouble of LaTeX and putting $ in for bode, when all the functionality of LaTeX formatting seems to work by default in regular plots.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Title에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by