Multistage Halfband IIR Filter Design
This example shows how to design multistage halfband IIR decimators.
Similar to FIR multirate filters, IIR halfband decimators/interpolators can be implemented using efficient polyphase structures. IIR polyphase filters present several interesting properties: they require a very small number of multipliers to implement, they are inherently stable, have low roundoff noise sensitivity and no limit cycles.
Butterworth and elliptic IIR filters can be designed with a halfband decimator/interpolator response type. Furthermore, it is possible to achieve almost linear phase response using specialized IIR design algorithms.
Cost Efficiency Case Study
A way of measuring a filter's computational cost is to determine how many multiplications need to be computed (on average) per input sample (MPIS). Consider a MPIS count case study: FIR vs IIR for the following filter specifications:
Fs = 9.6e3; % Sampling frequency: 9.6 kHz TW = 120; % Transition width Ast = 80; % Minimum stopband attenuation: 80 dB M = 8; % Decimation factor NyquistDecimDesign = fdesign.decimator(M,'Nyquist',M,TW,Ast,Fs);
Multistage Halfband FIR Design
A way of obtaining efficient FIR designs is through the use of multirate multistage techniques. This design results in three FIR halfband decimators in cascade. Halfband filters are extremely efficient because every other coefficient is zero.
MultistageFIRDecim = design(NyquistDecimDesign,'multistage',... 'HalfbandDesignMethod','equiripple','SystemObject',true); cost(MultistageFIRDecim)
ans = struct with fields: NumCoefficients: 69 NumStates: 126 MultiplicationsPerInputSample: 12.8750 AdditionsPerInputSample: 12
This method achieves computational costs of 12.875 MPIS on average.
Multistage Halfband IIR Design
Elliptic filters are the IIR equivalent of optimal equiripple filters. This design results in three IIR halfband decimators in cascade. Elliptic designs produce the most efficient IIR halfband designs.
MultistageIIRDecim = design(NyquistDecimDesign,'multistage',... 'HalfbandDesignMethod','ellip','SystemObject',true); cost(MultistageIIRDecim)
ans = struct with fields: NumCoefficients: 11 NumStates: 17 MultiplicationsPerInputSample: 2.5000 AdditionsPerInputSample: 5
This method achieves computational costs of only 2.5 MPIS on average.
If we overlay the magnitude responses of the FIR and IIR multirate multistages filters, the two filters look very similar and both meet the specifications.
fvFig = fvtool(MultistageFIRDecim,MultistageIIRDecim,'Color','white'); legend(fvFig, 'Multirate/Multistage FIR Polyphase', ... 'Multirate/Multistage IIR Polyphase')
Close inspection actually shows the passband ripples of the IIR filter to be far superior to that of the FIR filter. So computational cost savings don't come at the price of a degraded magnitude response.
fvtool(MultistageFIRDecim,MultistageIIRDecim,'Color','white'); title('Passband Magnitude Response (dB)') axis([0 0.325 -0.0016 0.0016])
Quasi-Linear Phase Halfband IIR Designs
By modifying the structure used to implement each IIR halfband filter, it is possible to achieve almost linear phase designs using IIR filters. This design also results in three halfband decimators in cascade. However, each halfband is implemented in a specific way that includes a pure delay connected in parallel with an allpass filter. This constraint on the implementation helps provide the quasi linear phase response. This comes at the expense of a slight increase in computational cost compared to elliptic designs.
IIRLinearPhaseFilt = design(NyquistDecimDesign,'multistage',... 'HalfbandDesignMethod','iirlinphase','SystemObject',true); cost(IIRLinearPhaseFilt)
ans = struct with fields: NumCoefficients: 25 NumStates: 55 MultiplicationsPerInputSample: 4.3750 AdditionsPerInputSample: 8.7500
Although not as efficient as the elliptic case, the design is nevertheless more efficient than using FIR halfbands.
Group Delay Comparison
Overlaying the group delay of the three designs, and focusing on the passband of the filter (the area of interest), we can verify that the latter IIR design achieves quasi-linear phase (almost flat group delay) in that area. In contrast, the elliptic filter, while more efficient (and with a lower group delay overall), has a clearly nonlinear phase response.
fvFig = fvtool(MultistageFIRDecim,MultistageIIRDecim,IIRLinearPhaseFilt,... 'Color','white','Analysis','grpdelay'); axis([0 0.6 0 225]) title('Passband Group delay') legend(fvFig, 'Linear-Phase FIR', 'Nonlinear Phase Elliptic IIR',... 'Quasi-Linear Phase IIR')
Polyphase IIR filters can be implemented in different ways. We have already encountered single-rate and multirate cascade allpass in previous sections. Now take a Hilbert transformer for example. A quasi linear-phase IIR Hilbert filter with a transition width of 96Hz and a maximum passband ripple of 0.1 dB can be implemented as a cascade wave digital filter using only 10 MPIS compared to 133 MPIS for an FIR equivalent:
HilbertDesign = fdesign.hilbert('TW,Ap',96,.1,Fs); HilbertIIRFilt = design(HilbertDesign,'iirlinphase',... 'FilterStructure','cascadewdfallpass',... 'SystemObject',true); cost(HilbertIIRFilt)
ans = struct with fields: NumCoefficients: 10 NumStates: 33 MultiplicationsPerInputSample: 10 AdditionsPerInputSample: 25
Wave digital filters have been proven to be very robust even when poles are close to the unit circle. They are inherently stable, have low roundoff noise properties and are free of limit cycles. To convert our IIR Hilbert filter to a fixed-point representation, we can use the realizemdl command and the Fixed-Point Tool to do the floating-point to fixed-point conversion of the Simulink model:
IIR filters have traditionally been considered much more efficient than their FIR counterparts in the sense that they require a much smaller number of coefficients in order to meet a given set of specifications.
Modern FIR filter design tools utilizing multirate/polyphase techniques have bridged the gap while providing linear-phase response along with good sensitivity to quantization effects and the absence of stability and limit cycles problems when implemented in fixed-point.
However, IIR polyphase filters enjoy most of the advantages that FIR filters have and require a very small number of multipliers to implement.