IIR FILTER Design
IIR FILTER Design
• Objectives:
Filters and Difference Equations
Signal Flow Graphs
FIR and IIR Filters
Bilinear Transform
Digital Conversion of Filters
Design of Analog Filters
Converting Difference Equations To Signal Flow Graphs
• Recall our expression for a linear, constant-coefficient difference equation:
y[n] a1 y[n 1] a2 y[n 2] ... a N y[n N ] b0 x[n] b1 x[n 1] ... bM x[n M ]
• This equation can be written succinctly using summations:
N M
y[n] ak y[n k ] bl x[n l ]
k 1 l 0
• We can draw a signal flow graph implementation of this equation:
x[n] b0 y[n]
+ +
b1
z 1
+ +
b2
z 1 + +
...
...
• This is known as the Direct Form I implementation of the above difference
equation. Can we implement this more efficiently?
. Slide 1
Direct Form II: Sharing Delay Elements (Memory)
• One of the more elementary aspects of the field of digital signal processing is
to develop more efficient implementations of digital filters, as well as improve
their ability to produce accurate results with less numerical precision.
• A more efficient implementation of our filter is a Direct Form II:
x[n] b0 y[n]
+ +
b1
+ z 1
+
b2
+ z 1 +
...
• This filter has the same transfer function, but shares the delay element
between the feedforward (moving average/finite impulse response) and
feedback (autoregressive/infinite impulse response) portions of the filter.
• Analog differential equations can be represented by similar signal flow graphs,
but their implementation involves physical components (e.g., RLCs, op amps).
. Slide 2
More About Types of Filters
• Consider a filter with only
feedforward components:
• The transfer function is:
M
y[n] bl x[n l ]
l 1
Y ( z) M
H ( z) bl z l
X ( z ) l 0
• Since the impulse response of this filter, h[n], has a finite number of nonzero
terms, this filter is referred to as a finite impulse response (FIR) filter. Observe
that this filter only has zeroes.
• Next, consider a filter with only
feedback components:
• The transfer function is:
N
y[n] ak y[n k ] b0 x[n]
k 1
b0
H ( z) N
1 ak z k
k 1
2 r 2 1
T 1 r 2r cos
2
2 2r sin
T 1 r 2 2r cos
• To understand the implications on frequency response, set r = 1 and = 0 :
2 sin 2
tan
T 1 cos T 2
T
2 tan 1
2
. Slide 5
Design Example: Butterworth Lowpass Filter
• Recall our expression for a second-order Butterworth filter:
c2
H ( s) 2
s 2c s c2
(1) Requirements: Let our sample frequency be 5 Hz, and our desired lowpass
cutoff frequency be 0.318 Hz (2 rd/sec). Our desired digital cutoff frequency
is 2 rd/sec * (1/5 Hz) = 0.4 rd.
(2) Prewarp: 2 2 0.4
c tan c tan 2.027 rd / sec
T 2 1 / 5 2
f c c / 2 0.323 Hz (shifted from 0.318 Hz )
c2 0.16
(3) Derive: H ( s ) 2
s 2c s c2 s 0.567 s 0.16
2
. Slide 6
Design of Analog Filters in MATLAB
• Butterworth: Let our sample frequency be 5 Hz, and our desired lowpass
cutoff frequency be 0.318 Hz (2 rd/sec). Our desired digital cutoff frequency is 2
rd/sec * (1/5 Hz) = 0.4 rd.
[z, p, k] = buttap(2); % creates a 2-pole filter
[num, den] = zp2tf(z, p, k);
wc = 2; % desired cutoff frequency
[num, den] = lp2lp(num, den, wc);
T = 0.2; • Note that a direct digital design
[numd, dend] = bilinear(num, den, 1/T); can be done using the “butter”
numd = [0.0302 0.0605 0.5724] command.
dend = [1 -1.4514 0.5724]
• Chebyshev Type 1 Highpass Filter:
Let our sample frequency be 5 Hz, and
our desired highpass cutoff frequency be
0.318 Hz (2 rd/sec). Our passband ripple
is 3 dB.
N = 2; % number of poles;
Rp = 3; % passband ripple;
T = 0.2; % sampling period;
• Note this filter was designed
wc = 2; % analog cutoff frequency; directly in the digital domain.
Wc = wc * T / pi; % normalized cutoff frequency
[numd, dend] = cheby1(N,Rp,Wc,’high’);
numd = [0.5697 -1.1394 0.5697]
dend = [1 -1.516 0.7028]
. Slide 7
Summary
• Introduced realizations of difference equations using signal flow graphs.
• Introduced the concept of FIR and IIR filters.
• Discussed a method for transforming an analog filter to a digital filter that
preserves the stability of the filter.
• Described a method to prewarp the frequency axis so that the analog filter
results in a digital filter at the correct frequency.
• Demonstrated this design process using Butterworth and Chebyshev
prototype analog filters.
. Slide 8