bode() yields wrong result

13 Ansichten (letzte 30 Tage)
Pascal Warten
Pascal Warten am 18 Dez. 2021
Kommentiert: Star Strider am 20 Dez. 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 Kommentare
Paul
Paul am 18 Dez. 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 am 20 Dez. 2021
Thank you for your tips regarding the specifications of the units.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Star Strider
Star Strider am 18 Dez. 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 Kommentare
Pascal Warten
Pascal Warten am 20 Dez. 2021
Thanks a lot!
Star Strider
Star Strider am 20 Dez. 2021
As always, my pleasure!
.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Get Started with Control System Toolbox finden Sie in Help Center und File Exchange

Produkte


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by