Iowa Hills Software Digital and Analog
IIR Filter Design Home
This IIR filter design program is free. It uses the bilinear transform to synthesize low pass, high pass, band pass, notch, and all pass filters from these polynomials:
The program has two test benches. The first allows you to test the filter with an impulse, square wave, sine wave, or a user defined signal. The program will display both the filtered and unfiltered signal in both the frequency and time domains.
It also has an audio test bench that allows you to apply the filter to a wav file which allows you to hear the affects of filtering. The program is available on our Download Page
If you are more interested in writing your own IIR program, see the Example C Code Page. The Code Kit has all the code necessary for generating IIR coefficients from the polynomials listed above. It also has the code for evaluating the filter's frequency response, as well as the code for implementing the filter.
Using the Bilinear Transform to design an IIR filter is quite simple. The basic procedure is given here, where we substitute the definition for the bilinear transform into H(s).
H(z) shows how to calculate the IIR filter coefficients from the analog low pass prototype coefficients A - F and T. T is determined by the desired 3 dB cutoff frequency Omega. The 2nd order analog filter coefficients (e.g. Butterworth coefficients) can be obtained from virtually any filter design book. More details are given here.
The stability of an IIR filter is always of some concern. If we start with a stable s plane filter, and we always do, then the bilinear transform is mathematically guaranteed to generate a stable IIR filter.
Instabilities can arise however because of implementation issues (numerical problems). The two most important aspects to consider are the size of the math registers and the type of implementation structure used. This shows the 11 ways the program allows you to test the filter's implementation, in floating point and fixed point.
Zero Input Limit Cycles
Zero Input Limit Cycles is the term generally used to describe the effect of the filter's inability to settle at zero after the input goes to zero. By definition an IIR filter has an infinitely long impulse response, but we assume the output will always tend toward zero after the input goes to zero.
In some cases however, depending on the type of filter and the number of bits used to implement the filter, the filter's output will approach some small value, and then oscillate indefinitely, or remain at a DC level. This happens because the filter can't clear its registers entirely and the residual re-circulates through the filter indefinitely never allowing the output to settle at zero. This residual output signal can be large enough to cause problems in some applications. High pass and notch filters are the most susceptible to this phenomenon. Here is an example of limit cycles at the output of a Chebyshev high pass.
Avoiding Register Overflow
A significant amount of effort went into this program to ensure that the math values generated by these filters are kept to a minimum. IIR filters differ from FIR filters in obvious ways, but one of the more important, and less obvious differences, is the peak math value generated by the filter. Both FIR and IIR filters generate their peak math value when processing a square wave.
With an FIR filter, the peak math value is the same as the amount of overshoot in the filter's step response and is seldom greater than ±1.2 if processing a ±1 square wave.
The peak math value generated by an IIR filter however depends on the implementation structure, the polynomial (Butterworth, etc), pass type (low pass, etc.), selectivity (highly selective filters generate larger math values), and the type and frequency of the signal being processed. The largest math values are generated by square waves of a specific frequency. The worst case frequency is also dependent on all the factors just mentioned.
To demonstrate, we list the peak math values generated by these filters in these structures. All are 8 pole low pass filters with OmegaC = 0.125. The Chebyshev had 0.2 dB Ripple, the Inv Cheby had a 60 dB Stop Band, and the Elliptic had a 0.2 dB Ripple and a 60 dB Stop Band.
|Peak Math Values Generated by a ±1 Square Wave|
|Biquad Form 1||1.4||1.63||3.56||3.9||4.46||4.9|
|Biquad Form 2||3.4||4.5||25.38||27.0||172.5||86.8|
|Nth Order Form 1||4.8||8.4||33.82||33.0||78.8||84.2|
|Nth Order Form 2||88.9||353||91.5E3||71.3E3||3.76E6||11.8E6|
10 Pole Inverse Chebyshev Low Pass Filter Example
This Filters Coefficients
Screen shot of the IIR Filter program (free). Available on the Download Page
Example coefficients (for the filter shown).
Screen shot of the program's test bench.
The Pole Zero locations are shown here. Signals may also be plotted in both the time and frequency domains.
Screen shot of the Audio Test Bench.
The Audio Test Bench allows you to filter a wav file, and play the results. This shows the spectrum for a filtered and unfiltered DTMF tone.
Copyright 2013 Iowa Hills Software