bode plot discrepancy

9 views (last 30 days)
aaa on 26 Jun 2012
i am plotting some bode plots, and i found the following discrepancy, and I'm not quite sure what is the root cause of it. My code is
Cu4 = tf([1 2], [1 2 6]);
[magCu4 phaseCu4 wout] = bode(Cu4,logspace(-2,7,300));
magCu4 = squeeze(magCu4);
phaseCu4 = squeeze(phaseCu4);
hold on
I expected that the semilogx plot of the magnitude should be identical to the plot of bode(Cu4), however, it doesnt seem to be the case. Where might I be going wrong with this?

Answers (2)

Arkadiy Turevskiy
Arkadiy Turevskiy on 26 Jun 2012
The very slight difference between two magnitude curves is due to the different frequencies you are computing the bode magnitude at. In your semilogx you are using wout, which you specified as logspace (-2,7,300). When you call bode with no frequency input argument, it determines the frequencies to compute the bode plot at automatically, and those frequencies are different from wout.
To better see that do this and zoom in on magnitude plot.
hold on
To have two identical magnitude curves, modify your code:
hold on
aaa on 27 Jun 2012
Hi, I seem to have figured out the problem. wout needs to be rewritten as a frequency i.e. wout/2pi for semilogx!!! small mistake, but huge difference. Thanks.

Sign in to comment.

Maryam Ghadrdan
Maryam Ghadrdan on 26 Jun 2012
what is the alternative way to get the phase plot?

Community Treasure Hunt

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

Start Hunting!

Translated by