bode() yields wrong result
13 次查看(过去 30 天)
显示 更早的评论
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 个评论
Paul
2021-12-18
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);
采纳的回答
Star Strider
2021-12-18
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;
.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Get Started with Control System Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!




