bode() yields wrong result

13 visualizzazioni (ultimi 30 giorni)
Pascal Warten
Pascal Warten il 18 Dic 2021
Commentato: Star Strider il 20 Dic 2021
Hello,
I would like to plot the Bode diagram of the following transfer function:
If I use the following code, I do not get appropriate results:
s = tf('s');
f1 = 0.99 * 18.88;
f2 = (1 + s / (2 * 3.1415 * 10.58)) / (1 + s / (s / (2 * 3.1415 * 26.74)));
f3 = (s / (2 * 3.1415 * 23.17)) / (1 + s / (2 * 3.1415 * 23.17));
f4 = (s / (2 * 3.1415 * 25.21)) / (1 + s / (2 * 3.1415 * 25.21));
f5 = 1 / (1 + s / (2 * 3.1415 * 48000));
bode(f1 * f2 * f3 * f4 * f5); grid on;
However, if I only plot one factor of the transfer function, it seems to work properly.
I would really appreaciate any help regarding this problem.
  4 Commenti
Paul
Paul il 18 Dic 2021
Most impportantly, correct the typo in f2 as indicated below by @Star Strider.
Also, bode() always works with frequencies in rad/TimeUnit. If you want to specify the frequency in Hz, you can do it manually.
s = tf('s');
f1 = 0.99 * 18.88;
f2 = (1 + s / (2 * 3.1415 * 10.58)) / (1 + s / (2 * 3.1415 * 26.74));
f3 = (s / (2 * 3.1415 * 23.17)) / (1 + s / (2 * 3.1415 * 23.17));
f4 = (s / (2 * 3.1415 * 25.21)) / (1 + s / (2 * 3.1415 * 25.21));
f5 = 1 / (1 + s / (2 * 3.1415 * 48000));
whz = logspace(0,6);
[m,p] = bode(f1 * f2 * f3 * f4 * f5,2*pi*whz);
semilogx(whz,db(squeeze(m)))
Or use bodeplot() to plot in Hz directly
opts = bodeoptions;
opts.FreqUnits = 'Hz';
bodeplot(f1*f2*f3*f4*f5,opts);
Pascal Warten
Pascal Warten il 20 Dic 2021
Thank you for your tips regarding the specifications of the units.

Accedi per commentare.

Risposta accettata

Star Strider
Star Strider il 18 Dic 2021
There is a typographical error in ‘f2’ and correcting it produces the desired result —
s = tf('s');
f1 = 0.99 * 18.88;
f2 = (1 + s / (10.58)) / (1 + s / (26.74));
f3 = (s / (23.17)) / (1 + s / (23.17));
f4 = (s / (25.21)) / (1 + s / (25.21));
f5 = 1 / (1 + s / (48000));
figure
bode(f1 * f2 * f3 * f4 * f5, {0 5E+7*2*pi})
grid on;
.
  2 Commenti
Pascal Warten
Pascal Warten il 20 Dic 2021
Thanks a lot!
Star Strider
Star Strider il 20 Dic 2021
As always, my pleasure!
.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Get Started with Control System Toolbox in Help Center e File Exchange

Prodotti


Release

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by