dbode results in phase shift that is wrong (I believe)

17 次查看(过去 30 天)
I'm looking at bode plots of linear phase FIR filters and I believe I am getting the wrong phase plot with filter order > 5.
In particular, I'm looking at a moving average filter.
% FIR phase error ?
% LFIR.m
Ts= 1E-3;
n=6;
num= (1/n)*[ones(1,n)];
den= [1 zeros(1,n)];
sys=tf(num,den,Ts);
figure(1); pzmap(sys);
figure(2); dbode(num,den,Ts);
From the pzmap it can be seen that for small positive frequencies on the unit circle the phase contribution should be near zero. However the dbode plot shows the phase at w=0 r/s to be 360 degree. If I use n=5 or less, I do get 0 deg phase at w ~= 0 rad/sec. Is this a problem with dbode?
MATLAB Version: 9.10.0.1739362 (R2021a) Update 5
Here are the pzmap and dbode for n=6:

采纳的回答

Paul
Paul 2022-1-21
dbode() callse bode(), which in turn has an algorithm that tries to "unwrap" the phase by adding multiples of 360 deg across the frequency range. But the phase at each frequency is still correct. We can see this, for example, at low frequency
Ts= 1E-3;
n=6;
num= (1/n)*[ones(1,n)];
den= [1 zeros(1,n)];
sys=tf(num,den,Ts);
[m,p,w] = bode(sys);
p(1)
ans = 357.9946
pcheck = angle(polyval(num,exp(1j*w(1)*Ts))/polyval(den,exp(1j*w(1)*Ts)))*180/pi
pcheck = -2.0054
pcheck + 360
ans = 357.9946
If you prefer the phase to always be between +-180, one approach is to use bodeplot() with phase wrapping on
opts = bodeoptions;
opts.PhaseWrapping = 'on';
bodeplot(sys,opts)
  1 个评论
Brian Tremaine
Brian Tremaine 2022-1-21
Thanks for the very clear and concise answer. Since most my work is on closed loop control systems I'm interested in the unwrapped phase shift below the Nyquist frequency.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matched Filter and Ambiguity Function 的更多信息

标签

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by