140 likes | 562 Views
IIR Filters and Equalizers. R.C. Maher ECEN4002/5002 DSP Laboratory Spring 2003. IIR Filter Description. We will consider IIR filters with a rational transfer function (M N):. +. y[n]. x[n]. b 0. Z -1. Z -1. y[n-1]. x[n-1]. -a 1. Z -1. b 1. Z -1. x[n-2]. y[n-2]. b 2. -a 2.
E N D
IIR Filters and Equalizers R.C. Maher ECEN4002/5002 DSP Laboratory Spring 2003
IIR Filter Description • We will consider IIR filters with a rational transfer function (MN): IIR and EQ R. C. Maher
+ y[n] x[n] b0 Z-1 Z-1 y[n-1] x[n-1] -a1 Z-1 b1 Z-1 x[n-2] y[n-2] b2 -a2 IIR Direct Form I • Rational transfer function leads to a direct implementation: IIR and EQ R. C. Maher
x[n] y[n] b0 + + Z-1 -a1 b1 Z-1 -a2 b2 IIR Direct Form II • Re-order feed-forward and feed-back sections: IIR and EQ R. C. Maher
Implementation Issues • Coefficient quantization • Precision usually limited to word size (24 bits on 56300) • Want coefficients to be large in magnitude to use as many significant bits as possible • Roundoff error (least significant bits lost) • Result from big accumulator (e.g., 60 bits) must be stored back as a single word (24 bits) • Roundoff error can accumulate due to recursive (feedback) structure of IIR filters IIR and EQ R. C. Maher
Implementation Issues (cont.) • Overflow error (most significant bits lost) • Occurs when arithmetic result is too large to fit in accumulator or in storage word size • Overflow can linger due to feedback • Requires scaling of the input and output • Coefficient quantization, roundoff error, and overflow error behavior can vary from one filter structure to another: choose wisely… IIR and EQ R. C. Maher
Engineering an IIR filter • Verify filter performance with quantized coefficients • Assess roundoff error by modeling the truncation as a noise source in the filter structure. Determine the transfer function from each roundoff noise source to the output. • Calculate overflow situations by looking for peaks in frequency response from input to each accumulation point in the filter. IIR and EQ R. C. Maher
2nd-order Sections • Generally implement high-order IIR filters as a sum or cascade of 2nd-order filters. • This reduces the sensitivity of the overall response to the precision of each coefficient • Each 2nd-order filter (biquad) implements two zeros and two poles (real or complex conjugate) IIR and EQ R. C. Maher
2nd-order Sections (cont.) • High-order polynomial is factored to find poles and zeros • Poles and zeros are grouped in pairs—usually try to group in such a way that minimizes peak gain of each section • If cascaded, 2nd-order sections are usually ordered from lowest gain to highest gain to minimize overflow likelihood • Scaling may be needed for overall response or for each section individually (computation vs. quality) IIR and EQ R. C. Maher
Bilinear Transform • Design algorithms for continuous-time filters are well known, while Nyquist issues make discrete-time IIR filter design somewhat complicated • Concept: use a continuous-time filter design, then transform s-plane poles and zeros to the z-plane • Need: an invertible mapping function between s and z planes IIR and EQ R. C. Maher
Bilinear Transform (cont.) • Mapping function must: • Take j axis in s-plane and map it to unit circle in z-plane (warped frequency response) • Take left half of s-plane and map to interior of unit circle (stable poles remain stable poles) • Have a smooth, monotonic warping • Customary function: IIR and EQ R. C. Maher
Bilinear Transform (cont.) • Inverse mapping is: • Frequency warping: z=ej IIR and EQ R. C. Maher
Bilinear Transform (cont.) • Plan: • Determine required critical frequencies and levels in digital domain, then use bilinear transform to find analog specs • Design continuous-time filter meeting warped specs • Inverse transform to get resulting digital design • Verify, then alter and repeat process as necessary IIR and EQ R. C. Maher
Lab Exercise #4 • MATLAB functions: butter, scope, iirtable • Write IIR filter function using output from iirtable. Use a “do loop” with iterations determined from iirtable. • Verify with file I/O and real time observation • Get working, then consider optimizations • Parametric equalizer (EQ) filter • Tune gain, center freq, and bandwidth • Adjust parameters with debugger and verify IIR and EQ R. C. Maher