# Matlab filter implementation

I have a filter response in the $$z$$-domain.

$$H_0(z) = 2 + 6z^{−1} + z^{−2} + 5z^{−3} + z^{−5}$$

How do I implement this filter on MATLAB?

I can do this if I have the coefficients but I do not know how to get them.

• Welcome here. It seems that a first step is to get the coefficients. What type of filter does this equation model Oct 25 '20 at 7:24

Your filter is a 5-tap delay line FIR filter. The FIR filter's coefficients are [2 6 1 5 1]. If x is your filter's input sequence and you execute the following MATLAB command:

h = [2 6 1 5 1];


you can then implement the filter (to produce a y output sequence) using the following MATLAB command:

y = filter(h, 1, x);


You can see your filter's frequency magnitude and phase responses by executing the following MATLAB command:

freqz(h, 1, 256)

• Shouldn't it be [2 6 1 5 0 1] since there is no $z^{-4}$ term? Oct 25 '20 at 17:29
• yes it shoud be [2 6 1 5 0 1]. Thank to you all
– user52384
Oct 26 '20 at 2:03
• Yes yes! [2 6 1 5 0 1] is correct. Sorry for the confusion. Oct 27 '20 at 8:01