What kind of filter is that? Is it IIR?

I am trying to answer the following question:

Is the system described by equation:

$$y[n]=0.5y[n-1]+x[n]-0.5x[n-1]$$

an IIR filter? My answer is yes.

Thank you

• there is a class of FIR filters called "Truncated IIR" (TIIR) filters. you can google that and you will find stuff from Julius Smith and Avery Wang. another example of TIIR filters is the Moving Sum or Moving Average filter or CIC filter (all pretty much different names for the same thing). what makes this recursive filter an FIR is pole-zero cancellation. as implemented, there are internal poles and if they were unstable, the filter could blow up inside, but you wouldn't see it in the output until there numerical limits were exceeded. Feb 19 '15 at 22:12
• what are the numerical limits? Feb 20 '15 at 11:12
• depends on the numerical type (float or fixed) and the word width. this stuff can be looked up. (say, for IEEE-754 floats. for fixed, it depends on how many bits, $n_I$, are left of the binary point; roughly $\pm 2^{n_I - 1}$. Feb 20 '15 at 17:20
• thank you again sirs for all help! it helps a lot I am glad I found this web site Feb 22 '15 at 17:49
• @AnthonyParks: You say: "why are people making this complicated..this is is clearly an IIR because first term of the filter has a feedback portion."? I say: "why people don't bother to understand the basic concepts of DSP"? IIR filter always implies the recursive form, but FIR doesn't necessary mean that the filter is non-recursive. That is the only correct answer and you are confusing the concepts here. If that was the exam question, you would fail by saying it is an IIR. Oppenheim explains this topic in his book on DSP.
– jojek
May 30 '15 at 21:57

This is the FIR filter, although it looks like an IIR. If you calculate the coefficients you get finite impulse response:

$h=[1]$

This happens due to zero-pole cancellation:

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

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

Yes, it can be tricky. Seeing $y[n-k]$ coefficients in LCCDE (Linear Constant Coefficients Difference Equation) doesn't necessarily mean it's an IIR filter. It might be just a recursive FIR filter.

• Still, if you implement the equations as originally stated, it will not behave exactly as H(z) = 1 because of finite word length effects (despite the pole-zero cancellation being exact in this case). Feb 19 '15 at 9:23
• That is true @Oscar, but these are numerical issues which have nothing to do with filter being F/IIR.
– jojek
Feb 19 '15 at 9:27
• @jojek: you are of course completely correct. However, using recursive FIR filters cause quite a bit of problems if you are unaware of these things (which many, even "high-quality" researchers, are). Hence, my comment. Ideally there should be a discussion of algorithm vs transfer function as well. Feb 19 '15 at 9:31
• jojek i am reading your answer from this question you answerd but i cannot comment. dsp.stackexchange.com/questions/17605/… can i use diffrent window? Feb 20 '15 at 11:18
• @BlackYasmin: Yes you can, just keep in mind you should call pwelch with appropriate window.
– jojek
Feb 20 '15 at 11:50

Jojek's answer is of course correct. I would just like to add some more information because much too often have I seen the terms "IIR" and "recursive" confused. The following implications always hold:

\begin{align}\text{IIR}& \Longrightarrow\text{recursive}\\ \text{non-recursive}&\Longrightarrow\text{FIR}\end{align}

i.e. every IIR filter (i.e. a discrete-time filter having an infinitely long impulse response) must be implemented recursively (unless you have infinite memory available), and every non-recursive LTI system has a finite impulse response (again, unless you have infinite memory).

However, the reverse is generally not true. A recursive filter can have a finite impulse response, as is the case for the example in the question. Another famous example is a moving average filter. This a non-recursive implementation of a moving average (necessarily FIR):

$$y[n]=\frac{1}{N}\sum_{k=n-N+1}^nx[k]$$

And this is a recursive implementation of the same filter (also FIR): $$y[n]=y[n-1]+\frac{1}{N}(x[n]-x[n-N])$$

• Concise and accurate as always, +1 ;) Thank you for bringing up the MA case.
– jojek
Feb 18 '15 at 22:48
• @jojek: yeah, I think it's a classic that everybody should know. Feb 18 '15 at 22:49
• And while I was primarily thinking of round-off noise in the comment to jojek's answer, for MA, overflow will be a potential issue which needs to be carefully considered. Easily solved by two's complement arithmetic and enough word length though. Feb 19 '15 at 9:26
• @Oscar: Well, after doing very simple analysis with double floating point precision I got an error of 8.881784197001252e-16. This is after processing the equivalent of 1 year of audio at sampling frequency 44.1kHz. Input data is a Gaussian noise with normalized distribution. Here is the code to reproduce the result !click! (it might take a 3 days to run). Providing this is correct, then I believe there is nothing to worry about.
– jojek
Mar 2 '15 at 9:25
• @jojek: Three things. 1) I was referring to the moving average filter of the answer, not the one in the original question. 2) Yes, that is OK for audio (but not exact, so no reason to put "no" in bold), but I prefer my safety critical signal processing to work independent of the input signal having synthetic properties. 3) The interesting thing is that the filter you simulated with will not have the problems I described (as the pole is inside the unit circle, not on it), but will always have round-off errors independent of representation (which can be avoided in the moving average case). Mar 3 '15 at 10:52