# Type of filter, given difference equation?

Given a difference equation, how do we tell if it is an IIR filter or FIR filter? For example,

y(n) = x(n-3)+y(n-1) . Is it FIR or IIR? Can you please give me a way to figure this out? Thanks! :)

Non-Recursive filters are synonym to FIR filters. if you will take z transform of difference equation which is non recursive then you will find out poles for FIR can lie at only zero.Hence if the equation is non-recursive then surely it will represent a FIR filter and its z transform will have all poles at zero.for example, if you have y(n)=x(n)-2x(n-1) then it is surely a FIR filter

But Recursive equations can represent IIR or FIR. case 1:when does a recursive can represent a FIR? if you introduce a unit delay in above equation then y(n-1)=x(n-1)-2x(n-2) and then subtract it from above one you will have y(n)-y(n-1)=x(n)+x(n-1)-2x(n-2) Now this equation is a recursive one and if you will find out its Z transform you will see that it has a pole at 1.then if you see its zeros it will surely have a zero at exactly at the same point at which pole is present hence it cancels the effect of that pole making the system give a finite response. case 1:when does a recursive can represent an IIR? this is the case which exactly fits the equation you provided in your example. Find z transform and you will see that a pole is present in z transform that lie at a position other than 0 causing the system to give infinite response

The difference equation of IIR filter is recursive, which means the current output depends upon the previous output (the output depends upon the infinite past). Your example is IIR.

On the other hand, the difference equation of FIR filter depends only upon the input. If the input is finite in duration, then the output is also finite in duration.

• Note that you can still have recursive-looking FIR filters like y[n]-y[n-1]=x[n]-x[n-3], so the above answer by @lennon310 is almost generally true. The example I gave has a 0-pole cancellation at z=0 so that's why the apparent recursiveness is anihilated 3 samples ahead and results in a FIR filter. If in doubt, check for existence of poles (except at 0 and infinity, which don't count). – Juancho Jan 16 '14 at 13:31
• @Juancho, i'm glad you pointed that out. i would say that poles at $z=0$ count as poles at $z=0$. to compute the complete frequency response, you have to deal with them just as you do any other pole. – robert bristow-johnson Jan 16 '14 at 14:33
• @Juancho why doesn't poles at 0 and infinity count? Any particular reason? – Masked Feb 9 '14 at 19:18
• $H(z) \times z^r$ adds poles at $z=0$ or $z=\infty$ depending on sign of $r$. In the time domain, this is the same filter but time-shifted ($h[n-r]$), so no effect on stability (which depends on the sum $\sum |h[k]|$). – Juancho Feb 10 '14 at 20:28

Find out if there are any non-zero poles in the transfer function(after pole-zero cancellation).

$y[n] - y[n-1] = x[n-3]$

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

$H(z) = \dfrac{Y(z)}{X(z)} = \dfrac{z^{-3}}{1-z^{-1}} = \dfrac{1}{z^{2}(z-1)}$

it has poles at $p_{0} = 1,\;\; p_{1}, p_{2} = 0$ so it is an IIR filter.

Some FIR filters can be realized with a recursive structure too. Cascaded Integrator-Comb filter is recursive version of the Moving Average filter. The recursive structure is more efficient than the straight forward transversal structure for implementing it.

$y[n] - y[n-1] = x[n] - x[n-3]$

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

$H(z) = \dfrac{Y(z)}{X(z)} = \dfrac{1-z^{-3}}{1-z^{-1}} = 1+z^{-1}+z^{-2} = \dfrac{z^{2}+z+1}{z^{2}}$

this has poles at $p_{0},p_{1} = 0$ and zeros at $z_{0},z_{1}=\dfrac{-1\pm \sqrt{3}j}{2}$

• "FIR filters don't have poles, they have zeros only." this is a falsehood. FIR filters have as many poles as they have zeros. but the FIR poles that are not canceled by zeros must be at $z=0$. all this is standard textbook stuff. what isn't standard textbook stuff are FIR filters with recursion, such as the efficient implementation of a moving average filter (sometimes called CIC filter). this filter also has a pole at $z=1$ like the example above, but that pole is canceled by a zero at the same location. – robert bristow-johnson Jan 16 '14 at 14:27
• @robertbristow-johnson FIR poles that are not canceled by zeros must be at z=0. Why is this the case? Your statement is true, for example H(Z) = 0.5(1+z^-1) is an FIR, and has a pole at z=0. Any explanation? – Masked Feb 9 '14 at 19:24