フィルターのクリア

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

17 ビュー (過去 30 日間)
Brian Tremaine
Brian Tremaine 2022 年 1 月 21 日
コメント済み: Brian Tremaine 2022 年 1 月 21 日
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 Center および File ExchangeMatched 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