16 IIR Filter Design

Download as pdf or txt
Download as pdf or txt
You are on page 1of 23

Digital Signal Processing

Discussion #16
IIR Filter Design

Tarun Choubisa
Dept of ETC,
KIIT University

12 April 2011 1
Introduction
•Analog filter design theory was developed in
the mid-1900’s.
•As digital signal processing developed, it
seemed reasonable to leverage existing
knowledge in analog filter design.
•Our strategy will be to design the filter in the
analog domain, and then transform the filter
to the digital domain.
Introduction
• IIR filter design methods
Normalized analog
lowpass filter

Continuous frequency
band transformation

Impulse Bilinear Step invariance


Invariance transformation method
method method

IIR filter

Feb.2008 3
IIR Filter Design by Impulse invariance method

• The most straightforward of these is the


impulse invariance transformation
• Let hc (t ) be the impulse response
corresponding to H c ( s) , and define the
continuous to discrete time transformation
by setting h(n) hc (nT )
• We sample the continuous time impulse
response to produce the discrete time filter
Feb.2008 4
IIR Filter Design by Impulse invariance method

• H c ( s ) is expanded a partial fraction expansion


to produce N
Ak
H c ( s)
k 1 s sk

• We have assumed that there are no multiple


poles N
sk t N
hc (t ) Ak e u (t ) h( n) Ak e sk nT u (n)
k 1
k 1

• And thus N
Ak
H ( z) sk T 1
k 1 1 e z
Feb.2008 5
IIR Filter Design by Impulse invariance method

• Example: s a
H c ( s)
( s a) 2 b 2
Expanding in a partial fraction
expansion, it produce 1/ 2 1/ 2
H c ( s)
s a jb s a jb

The impulse invariant transformation


yields a discrete time design with the
1/ 2 1/ 2
system function H ( z) ( a jb )T 1
1 e z 1 e( a jb )T
z 1

Feb.2008 DISP Lab 6


Impulse Response of a Filter

• IIR filter that has poles placed on the unit circle at e j 0

ej
1
a0 a1Z
H ( z) 1 2
1 b1Z b2 Z
0

e-j

7
Filter Coefficients

• Output frequency 0
• Cosine wave: h(n) = cos( 0T) u(n)
– a0 = 1, a1 = cos( 0T)
– b1 = 2cos( 0T), b2 = -1
• Sine wave: h(n) = sin( 0T) u(n)
– a0 = 0, a1 = sin( 0T)
– b_1 = 2cos( 0T), b2 = -1

8
Effect of Coefficient Quantization

• Implemented as recursive filter on a DSP


• Accuracy of output frequency 0
dependent on the accuracy of filter
coefficients
– depends on accuracy of cos( 0T)
– difficult to implement in finite precision
arithmetic (quantization error)

9
Effect of Coefficient Quantization

Im
Z plane Direct Form
Implementation (3 bits
+ sign bit)
rad. 0 rad. Re
-1.0 -0.5 0 0.5 1.0
Coefficient quantization can change the pole locations and hence the output frequency

• Uniform quantization of filter coefficients


– Possible to obtain only certain output
frequencies (pole locations)
– Pole locations more closely spaced around
/2 radians than in the regions corresponding
10
to 0 and radians
Effect of Coefficient Quantization
An originally stable IIR filter with precession coefficients may
become unstable after implementation due to unavoidable
quantization error in its coefficients. !!!
1
H ( z) 1 2
1 1.845 z 0.850586 z
Stable IIR filter

After quantization
unstable IIR filter
1
H ( z) 1 2
1 1.85 z 0.85 z
Effect of Coefficient Quantization
%Demonistration for the effect of quantization of filter
coefficients
L=100; %L is the length of the impulse response h[n]
num=[1];
den=[1 -1.845 0.850586];
den2=[1 -1.85 0.85]
[h1 t]=impz(num,den,L);
subplot(2,1,1);
stem(h1); This program draws the
ylabel('Amplitude'); previous impulse
xlabel('Time index n'); response that shows the
[h2 t]=impz(num,den2,L);
subplot(2,1,2); effect of quantization on
stem(h2); the system stability.
ylabel('Amplitude');
xlabel('Time index n');
IIR Filter Design by Impulse invariance method

• The impulse invariance transformation does


map the j -axis and the left-half s plane into
the unit circle and its interior, respectively
j Im(Z)

esT

Re(Z)

S domain Z domain

Feb.2008 13
Complex-plane mapping in impulse invariance transformation

If Ha is band limited, there will be no aliasing, and if it is


not band limited there will be aliasing as it was seen
before.
Properties:
• Sigma = Re(s):
– Sigma < 0, maps into |z|<1 (inside of the UC)
– Sigma = 0, maps into |z|=1 (on the UC)
– Sigma >0, maps into |Z|>1 (outside of the UC)
• Many s to one z mapping: many-to-one mapping
– Every semi-infinite left strip (so the whole left plane) maps
to inside of unit circle
• Causality and Stability are the same without
changing;
• Aliasing occur if filter not exactly band-limited
Ex: Given the digital lowpass filter specifications wp,ws,Rp and As, we
want to determine H(z) by first designing an equivalent analog filter
and then mapping it into the desired digital filter. Design Procedure:

1. Choose T and determine the analog frequencies:


Ωp=wp/T, Ωs=ws/T
2. Design an analog filter Ha(s) using the specifications with one of the three
prototypes .
3. Using partial fraction expansion, expand Ha(s) into
N Rk
H a (s) k 1
s pk
4. Now transform analog poles {pk} into digital poles {epkT} to obtain the digital filter

N Rk
H ( z) k 1
1 e pk T z 1
IIR Filter Design by Impulse invariance method
• Example:
s a
H c ( s)
( s a) 2 b 2
Expanding in a partial fraction
expansion, it produce 1/ 2 1/ 2
H c ( s)
s a jb s a jb

The impulse invariant transformation


yields a discrete time design with the
system function 1/ 2 1/ 2
H ( z)
1 e( a jb )T
z 1
1 e( a jb )T
z 1

Feb.2008 DISP Lab 17


Advantages of Impulse Invariance Mapping

• It is a stable design and the frequencies Ω and w are


linearly related.
• Disadvantage
– We should expect some aliasing of the analog frequency
response, and in some cases this aliasing is intolerable.
• Consequently, this design method is useful only
when the analog filter is essentially band-limited to a
lowpass or bandpass filter in which there are no
oscillations in the stopband.
IIR Filter Design by Bilinear transformation
method
• The most generally useful is the
bilinear transformation.
• To avoid aliasing of the frequency response as
encountered with the impulse invariance
transformation.
• We need a one-to-one mapping from the s
plane to the z plane.
• The problem with the transformation is
many-to-one. z esT
Feb.2008 19
Design of Digital Filters Using Analog Prototypes

• Analog filter design theory was developed in the mid-1900’s.


• As digital signal processing developed, it seemed reasonable to leverage existing
knowledge in analog filter design.
• Our strategy will be to design the filter in the analog domain, and then transform the filter
to the digital domain.
• We can derive this transformation by recalling the relationship between the Laplace
transform and the z-transform:
1
z e sT s ln( z )
T
• We can approximate the logarithm using a Taylor series:
1 2 z 1 2 1 z1
s ln( z )
T T z 1 T 1 z1
• This transformation is known as the bilinear transform. It maps the left-half
s-plane to the interior of the unit circle in the z-plane.
• Unfortunately, it also “warps” the frequency axis, so the analog filter design must be
prewarped so that it lands at the proper frequency in the z-plane.
Let s = + j and z = re j :
2 1 re j
j
T 1 re j
Frequency Warping In the Bilinear Transform

• We can solve for and by equating real and imaginary parts:

2 r2 1
T 1 r 2 2r cos
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
1 T
2 tan
2

• This suggests a design strategy where:


(1) Establish requirements (e.g., cutoff frequency of c).
2
(2) “Prewarp” by computing the equivalent analog frequency: c . tan c
T 2
(3) Design an analog filter, generating H(s).
(4) Derive: H ( z ) H ( s) s 2z 1
Tz 1
Impulse response of a filter
Impulse response of an IIR filter with poles on the unit circle for sinusoidal generation
Acknowledgement
• Various graphics used here has been taken from
public resources instead of redrawing it. Thanks to
those who have created it.
• Thanks to:
– Prof. John G. Proakis
– Prof. Dimitris G. Manolakis

You might also like