bode plot discrepancy

조회 수: 16 (최근 30일)
aaa
aaa 2012년 6월 26일
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);
semilogx(wout,20*log10(magCu4)),grid;
hold on
bode(Cu4,'r')
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?
TIA

답변 (2개)

Arkadiy Turevskiy
Arkadiy Turevskiy 2012년 6월 26일
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.
close;
semilogx(wout,20*log10(magCu4),'x'),grid;
hold on
bode(Cu4,'ro')
To have two identical magnitude curves, modify your code:
semilogx(wout,20*log10(magCu4)),grid;
hold on
bode(Cu4,wout,'r')
Arkadiy
  댓글 수: 2
aaa
aaa 2012년 6월 27일
Hi Arkadiy.
When i use
bode(Cu4,wout)
I still do not see the same plot. I'm seeing the same problem with the phase. Have I perhaps misread your suggestion?
aaa
aaa 2012년 6월 27일
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.

댓글을 달려면 로그인하십시오.


Maryam Ghadrdan
Maryam Ghadrdan 2012년 6월 26일
what is the alternative way to get the phase plot?

카테고리

Help CenterFile Exchange에서 Plot Customization에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by