IIR Filters and Equalizers R C Maher ECEN

  • Slides: 14
Download presentation
IIR Filters and Equalizers R. C. Maher ECEN 4002/5002 DSP Laboratory Spring 2002

IIR Filters and Equalizers R. C. Maher ECEN 4002/5002 DSP Laboratory Spring 2002

IIR Filter Description • We will consider IIR filters with a rational transfer function

IIR Filter Description • We will consider IIR filters with a rational transfer function (M N): ECEN 4002 Spring 2002 IIR and EQ R. C. Maher 2

IIR Direct Form I • Rational transfer function leads to a direct implementation: y[n]

IIR Direct Form I • Rational transfer function leads to a direct implementation: y[n] x[n] + Z-1 b 0 Z-1 y[n-1] x[n-1] Z-1 b 1 -a 1 x[n-2] b 2 ECEN 4002 Spring 2002 IIR and EQ Z-1 y[n-2] -a 2 R. C. Maher 3

IIR Direct Form II • Re-order feed-forward and feed-back sections: x[n] + Z-1 -a

IIR Direct Form II • Re-order feed-forward and feed-back sections: x[n] + Z-1 -a 1 Z-1 -a 2 ECEN 4002 Spring 2002 b 0 + y[n] b 1 b 2 IIR and EQ R. C. Maher 4

Implementation Issues • Coefficient quantization – Precision usually limited to word size (24 bits

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 ECEN 4002 Spring 2002 IIR and EQ R. C. Maher 5

Implementation Issues (cont. ) • Overflow error (most significant bits lost) – Occurs when

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… ECEN 4002 Spring 2002 IIR and EQ R. C. Maher 6

Engineering an IIR filter • Verify filter performance with quantized coefficients • Assess roundoff

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. ECEN 4002 Spring 2002 IIR and EQ R. C. Maher 7

nd 2 -order Sections • Generally implement high-order IIR filters as a sum or

nd 2 -order Sections • Generally implement high-order IIR filters as a sum or cascade of 2 nd-order filters. • This reduces the sensitivity of the overall response to the precision of each coefficient • Each 2 nd-order filter (biquad) implements two zeros and two poles (real or complex conjugate) ECEN 4002 Spring 2002 IIR and EQ R. C. Maher 8

nd 2 -order Sections (cont. ) • High-order polynomial is factored to find poles

nd 2 -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, 2 nd-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) ECEN 4002 Spring 2002 IIR and EQ R. C. Maher 9

Bilinear Transform • Design algorithms for continuous-time filters are well known, while Nyquist issues

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 ECEN 4002 Spring 2002 IIR and EQ R. C. Maher 10

Bilinear Transform (cont. ) • Mapping function must: – Take j axis in s-plane

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: ECEN 4002 Spring 2002 IIR and EQ R. C. Maher 11

Bilinear Transform (cont. ) • Inverse mapping is: • Frequency warping: z=ej ECEN 4002

Bilinear Transform (cont. ) • Inverse mapping is: • Frequency warping: z=ej ECEN 4002 Spring 2002 IIR and EQ R. C. Maher 12

Bilinear Transform (cont. ) • Plan: – Determine required critical frequencies and levels in

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 ECEN 4002 Spring 2002 IIR and EQ R. C. Maher 13

Lab Exercise #4 • MATLAB functions: butter, scope, iirtable – Write IIR filter function

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 ECEN 4002 Spring 2002 IIR and EQ R. C. Maher 14