Legends in Bode plots do not support subscripts

19 ビュー (過去 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 Center および File ExchangeTitle についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by