tf2zpk vs. zp2tf
6 ビュー (過去 30 日間)
古いコメントを表示
I used tf2zpk to get zeros, poles and gain, then use zp2tf to get the transfer function, shown below. [z22,p22,k22] = tf2zpk(h22',1); [b,a] = zp2tf(z22,p22,k22); plot(h22-b');
I expect h22 is same as b but there is big difference. Did I miss anything?
Thanks,
Yun
1 件のコメント
回答 (1 件)
Vandana Rajan
2016 年 12 月 23 日
Hi,
There might be some issues with your 'h22'. Note that you should use tf2zpk when working with transfer functions expressed in inverse powers (1 + z-1 + z-2), which is how transfer functions are usually expressed in DSP. A similar function, tf2zp, is more useful for working with positive powers (s2 + s + 1), such as in continuous-time transfer functions.
You may try out the following
[b,a] = butter(3,.4);
fvtool(b,a,'polezero')
[z,p,k] = tf2zpk(b,a)
text(real(z)-0.1,imag(z)-0.1,'\bfZeros','color',[0 0.4 0])
text(real(p)-0.1,imag(p)-0.1,'\bfPoles','color',[0.6 0 0])
[b1,a1] = zp2tf(z,p,k)
b1 and a1 turn out to be equal to b and a.
2 件のコメント
Vandana Rajan
2017 年 2 月 21 日
Hi,
Computing the transfer function from a large number of zeros creates numerical problems as you multiply several roots together. The problem becomes more visible as the number of filter coefficients increases (as can be seen in this case).
It is never a good idea to directly compute the transfer function of a filter from its roots as you are trying to do in this case. Using second order sections provides a more stable filter representation. This can be observed by adding the following 2 lines of code at the end of your script, for_mathworks.m: sos = zp2sos(z22,p22,k22); fvtool(h22,1,h22b,h22a, sos) You can see how the second order section representation is comparable to the original response in the filter visualization tool output.
You can refer to the following documentation for more information about the fv tool and the 'sos' function: https://www.mathworks.com/help/signal/ref/fvtool.html https://www.mathworks.com/help/dsp/ref/sos.html
[Pasting here the mail sent from MathWorks Technical Support, so that the information can be useful for other community members too]
参考
カテゴリ
Help Center および File Exchange で Digital Filtering についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!