Filter Z Transform Implementation

38 ビュー (過去 30 日間)
LB
LB 2021 年 1 月 22 日
コメント済み: Star Strider 2021 年 1 月 22 日
Hello,
I would like to know how to implement a filter in Matlab in the Z transform like : H(z)= -1/2 - z^(-1) - 1/2*z^-2
Im trying to get the impulse response with impz but have since failed in doing so.
Thank you

採用された回答

Star Strider
Star Strider 2021 年 1 月 22 日
The easiest way is to let the Control System Toolbox do the initial analysis:
z = tf('z'); % Use Control System Toolbox Functions
H = tf( -1/2 - z^(-1) - 1/2*z^-2, 'Variable','z^-1')
filt_a = H.Numerator{:};
filt_b = H.Denominator{:};
figure
freqz(filt_b, filt_a)
figure
impulse(H)
figure
impz(filt_b, filt_a)
producing:
H =
-0.5 z^3 - z^2 - 0.5 z
----------------------
z^3
Sample time: unspecified
Discrete-time transfer function.
and the plots.
  2 件のコメント
LB
LB 2021 年 1 月 22 日
編集済み: LB 2021 年 1 月 22 日
Is it always freqz(den,num) or freqz(num,den)?
Im confused my teachers use impz freqz...(num,den)
EDIT: would something like num = [-1/2 -1 -1/2], den=1, h=impz(num,den), impz(h) work?
Thank you!
Star Strider
Star Strider 2021 年 1 月 22 日
I always used:
freqz(num, den)
that appears to be correct according to the freqz documentation.
‘... would something like num = [-1/2 -1 -1/2], den=1, h=impz(num,den), impz(h) work?
Not exactly, although this would:
num = [-1/2 -1 -1/2];
den = 1;
[h,t] = impz(num,den);
figure
stem(t, h, 'filled', 'LineWidth',2)
axis([0 max(t)+0.5 -1.5 1.5])
.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDigital Filter Analysis についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by