Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 14

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 (MeN):
M 1

b z
k

k

H ( z) !

k !0 N 1

1  ak z
k !1

k

ECEN4002 Spring 2003

IIR and EQ

R. C. Maher

IIR Direct Form I


Rational transfer function leads to a direct implementation:
x[n] + Z-1 x[n-1] Z-1 x[n-2] y[n-2] b2 -a2 b1 -a1 Z-1 b0 Z-1 y[n-1] y[n]

y[ n] ! b0 x[n]  b1 x[ n  1]  b2 x[n  2]  a1 y[ n  1]  a2 y[ n  2]
ECEN4002 Spring 2003 IIR and EQ R. C. Maher 3

IIR Direct Form II


Re-order feed-forward and feed-back sections:
x[n] +

Z-1
-a1

b0

y[n]

Z-1

b1

-a2

b2

ECEN4002 Spring 2003

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
ECEN4002 Spring 2003 IIR and EQ R. C. Maher 5

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
ECEN4002 Spring 2003 IIR and EQ R. C. Maher 6

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.
ECEN4002 Spring 2003 IIR and EQ R. C. Maher 7

nd-order 2

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) 1 2
b0  b1 z  b2 z H ( z) ! 1  a1 z 1  a 2 z  2
IIR and EQ R. C. Maher

ECEN4002 Spring 2003

nd-order 2

Sections (cont.)

High-order polynomial is factored to find poles and zeros Poles and zeros are grouped in pairsusually 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)
ECEN4002 Spring 2003 IIR and EQ R. C. Maher 9

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
ECEN4002 Spring 2003 IIR and EQ R. C. Maher 10

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:

1 s z ! ] (s) ! 1 s
R. C. Maher 11

ECEN4002 Spring 2003

IIR and EQ

Bilinear Transform (cont.)


Inverse mapping is:
z 1 s ! ] ( z) ! z 1
1

Frequency warping: z=ej[


sin 2 [ [ j; ! j ! j tan cos 2 [ 2
ECEN4002 Spring 2003 IIR and EQ R. C. Maher 12

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
ECEN4002 Spring 2003 IIR and EQ R. C. Maher 13

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

ECEN4002 Spring 2003

IIR and EQ

R. C. Maher

14

You might also like