IIR Filter Implementation

As with the FIR filter, given a sampled signal s [n], the output of an IIR filter would be given by the following code :

		output [n] = b0 * s [n] + b1 * s [n-1] + b2 * s [n-2] - 
				a1 * output [n-1] - a2 * output [n-2] ;
		

Notice that the value of output [n] depends on the values of output [n-1] and output [n-2]. As with the FIR filter, undefined values should be set to zero.

This filter has 5 coefficients (more are possible) and they are grouped according to whether they affect the input (s[n]) or the previous outputs (output [n-whatever]).

The order of an IIR filter is whatever is the maximum of the number of aX and bX coefficients above.


back.png next.png