0

I have a difference equation

$$y[n] = y[n-1] + 0.5x[n] - 0.5x[n-2] \text{.}$$

According to this answer, the filter should have finite impulse response. I just can't figure out how to get the FIR filter coefficients. I tried to use the transfer function.

$$Y(z) - Y(z)z^{-1} = 0.5X(z) - 0.5X(z)z^{-2}$$

$$H(z) = \frac{Y(z)}{X(z)} = \frac{0.5 - 0.5z^{-2}}{1-z^{-1}}$$

But here I got stuck. Can anyone tell me how to make this a non-recursive implementation?

DaBler
  • 206
  • 1
  • 13

2 Answers2

3

You can simplify the z-transform further,

$ H(z) = \frac{Y(z)}{X(z)}= \frac{0.5-0.5z^{-2}}{1-z^{-1}}$

$ H(z) = \frac{(1-z^{-1})(1+z^{-1})}{2(1-z^{-1})} $

canceling the common pole and zero

$ H(z) = \frac {1+z^{-1}}{2}$

take inverse z-transform

$ Y(n) = \frac{x(n)+x(n-1)}{2} $

H.Kumar
  • 46
  • 3
3

There is already a good answer, but here is some extra explanation.

This is called "pole/zero cancellation". That means you have a pole, say, $z_p$ but you also have a zero at $z_p$ so the zero cancels the pole.

One particular example where this can be useful is a moving average filter of length $N$, The transfer function is

$$H(z) = \frac{1}{N} \sum_{n=0}^{N-1} z^{-n} = \frac{1}{N} \cdot \frac{1-z^{-N}}{1-z^{-1}}$$

That makes the difference equation

$$y[n] = \frac{1}{N}\sum_{k=0}^{N-1} x[n-k] = y[n-1] + \frac{1}{N} (x[n]-x[n-N])$$

The FIR form of the difference equation has $N$ coefficients, but the IIR form with pole cancelation has only three non-zero coefficients, so it's often more efficient to implement it that way.

Hilmar
  • 44,604
  • 1
  • 32
  • 63