Previous Using IDL: Signal Processing Next

Infinite Impulse Response (IIR) Filters

Digital filters which must be implemented recursively are called Infinite Impulse Response (IIR) filters because, theoretically, the response of these filters to an impulse never settles to zero. In practice, the impulse response of many IIR filters approaches zero asymptotically, and may actually reach zero in a finite number of samples due to the finite word length of digital computers.

One method of designing digital filters starts with the Laplace transform representation of an analog filter with the required frequency response. For example, the Laplace transform representation (or continuous transfer function) of a second order notch filter with the notch at f0 cycles per second is:

where s is the Laplace transform variable. Then the continuous transfer function is converted to the equivalent discrete transfer function using one of several techniques. One of these is the bilinear (Tustin) transform, where

(2/d)*(z-1)/(z+1)  

is substituted for the Laplace transform variable s. In this expression, z is the unit delay operator.

For the notch filter above, the bilinear transformation yields the following discrete transfer function:

where c = (1 – p*f0*d) / (1 + p*f0*d).

Enter the following IDL statements to compute the coefficients of the discrete transfer function:

delt = 0.02  
; Notch frequency in cycles per second:  
f0 = 6.5  
c = (1.0-!PI*F0*delt) / (1.0+!PI*F0*delt)  
b = [(1+c^2)/2, -2*c, (1+c^2)/2]  
a = [ c^2, -2*c, 1]  


Example Code
Alternately, type @sigprc13 at the IDL prompt to run the sigprc13 batch file and create the plot variables. See Running the Example Code if IDL does not find the batch file.

IIR Filter Implementation

Since an Infinite Impulse Response filter contains feedback loops, its output at every time step depends on previous outputs, and the filter must be implemented recursively with difference equations. The discrete transfer function

is implemented with the difference equation

An IIR filter is stable if the absolute values of the roots of the denominator of the discrete transfer function a(z) are all less than one. The impulse response of a stable IIR filter approaches zero as the time index k approaches infinity. The frequency response function of a stable IIR filter is the Discrete Fourier Transform of the filter's impulse response.

The figure below plots the impulse and frequency response functions of the notch filter defined above using recursive difference equations.

Figure 6-12: Impulse and Frequency Response of a Notch Filter

Figure 6-12: Impulse and Frequency Response of a Notch Filter


Example Code
Type @sigprc14 at the IDL prompt to run the batch file that creates this display. The source code is located in sigprc14, in the examples/doc/signal directory. See Running the Example Code if IDL does not find the batch file.


Note
Because the impulse response approaches zero, IDL may warn of floating-point underflow errors. This is an expected consequence of the digital implementation of an Infinite Impulse Response filter.

The same code could be used to filter any input sequence u(k).

  IDL Online Help (March 06, 2007)