MATLAB: Filter Z Transform Implementation

digital signal processingfilterMATLABsignal processing

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

Best Answer

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.