dbode results in phase shift that is wrong (I believe)
17 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/868890/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/868895/image.png)
0 commentaires
Réponse acceptée
Paul
le 21 Jan 2022
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)
pcheck = angle(polyval(num,exp(1j*w(1)*Ts))/polyval(den,exp(1j*w(1)*Ts)))*180/pi
pcheck + 360
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)
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Matched Filter and Ambiguity Function dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!