- design the filter parameters according to desired goal
- convert the design to the selected filter structure
- realize the difference equation(s) for the filter structure to process the input signal to produce the output signal.

y[n] = h[0] x[n] + h[1] x[n-1] + ... + h[N-1] x[n - (L-1)]

for n ≥ 0 where L is the number of FIR filter coefficients and h[n] is the FIR filter impulse response. As a necessary condition for linear and time-invariance (LTI) to hold, the initial conditions { x[-1], x[-2], ..., x[-(L-1)] } must be zero. The order of the filter would be N which is L - 1.

**IIR filter**. We can design the filter parameters by (a) manually placing poles and zeros, or (b) using an automated design algorithm such as elliptic design, or (c) using a pre-designed filter such as a second-order bandpass filter used in homework 1.1(d). An Nth order filter means there are N poles; there are N zeros although some might be zero-valued. The most common filter structure is to use a cascade of biquads for even-order filters or a cascade of biquads plus a first-order section. One heuristic is order the biquads in ascending order of quality factors from input to output. See the "best mapping" below that uses an exhaustive search. For a causal implementation of the filter with input signal x[n] and output signal y[n] as a single section, the difference equation is in terms of the previous output values as well as the current and previous input values, i.e.

y[n] = a[1] y[n-1] + ... + a[N] y[n - N] + b[0] x[n] + b[1] x[n-1] + ... + b[N] x[n - N]

for n ≥ where { a[0], a[1], ..., a[N] } are the feedback coefficients with a[0] = 1 and { b[0], b[1], ..., b[N] } are the feedforward coefficients. As a necessary condition for LTI to hold, the initial conditions { y[-1], y[-2], ..., y[-N] } and { x[-1], x[-2], ..., x[-N] } must be zero.

**Quantization error**. For FIR and IIR filters, implementation of the difference equation in step 3 will be in particular numeric format, e.g. 16-bit integer or 32-bit floating point. The result of every multiplication and addition will be truncated or rounded to the numeric format, which will lead to quantization error in the output signal amplitude values. This quantization error in calculating the output values is in addition to any quantization errors that would have occured in step 2. For an IIR filter, the quantization error for output value y[n] is propagated to future output values in an IIR filter, whereas this is not the case for an FIR filter. When we design an IIR in terms of poles and zeros, we expanding the factored form of the transfer function into unfactored form, i.e. a ratio of two polynomials, to obtain the feedback and feedforward coefficients. This can lead to perturbations of the pole and zero locations, which can sometimes lead to the filter not meeting the desired goal and even bounded-input bounded-output (BIBO) instability.

**Best mapping of poles and zeros to cascaded form**. We have a cascade of B biquads for an Nth-order IIR filter, where B = N/2 if N is even and B = (N-1)/2 if N is odd. To find the best mapping of poles and zeros to cascaded form, we'd have to simulate all possible mappings of poles and zeros to capture the quantization effects mentioned above. We have B conjugate pole pairs, and B pairs of zeros. In an elliptic design, the most common case is that all zeros are in conjugate pairs, but for Butterworth designs, it is common for many of the zeros to be zero-valued or some other real value.

As an example mapping of poles and zeros, we take one of the B conjugate pairs of poles and place it in the first biquad in the cascade. We then select from the remaining B-1 conjugate pairs of poles for the second biquad, and so forth. This has B! possibilities. For the first biquad, there are B possible choices of zero pairs, B-1 choices for the second biquad, etc. So, in total, we would have B! B! possibilities. This would mean 1 possibility when B = 1; 4 for B = 2; 36 for B = 3; 567 for B = 4; 14440 for B = 5, etc. We can simulate each mapping in parallel for speed. Each simulation would input test signals that have all discrete-time frequencies in them (e.g. a chirp signal, Gaussian noise, and an impulse) and compare the output spectrum to the ideal output spectrum by computing a mean-squared error. The filter with the closest match would be chosen.

We can use a heuristic to reduce the number of mappings that would need to be simulated. We proceed with the mapping of the conjugate pole pairs as before, we have B! possibilities. For a particular biquad, we chose the zero pair that is closest in distance to the conjugate pole pair. This will reduce the number simulations from B! B! to B!.

Last updated 06/07/22. Send comments to bevans@ece.utexas.edu