Professional Documents
Culture Documents
Iir Filter PDF
Iir Filter PDF
IIR Filters
In this chapter we finally study the general infinite
impulse response (IIR) difference equation that was men-
8
tioned back in Chapter 5. The filters will now include both feed-
back and feedforward terms. The system function will be a
rational function where in general both the zeros and the poles
are at nonzero locations in the z-plane.
Block Diagram
As a special case consider N = M = 3
3 3
yn = al y n l + bk x n k
l=1 k=0
xn yn
1 b0 1
z z
xn 1 yn 1
1 a1 1
z b1 z
xn 2 yn 2
1 1
z b2 a2 z
xn 3 yn 3
Feed-forward Feedback
part b3 a3 part
Time-Domain Response
To get started with IIR time-domain analysis we will consider
a first-order filter ( N = 1 ) with M = 0
y n = a1 y n 1 + b0 x n (8.3)
0.6
0.4
0.2
n
5 10 15 20
N2
yn = x k h n k
k = N1
(8.6)
N2
nk
= x k b0 a1 un k
k = N1
0.5
n
5 10 15 20
0.5
yn 2.5
1.5
0.5
n
5 10 15 20
n0 n0
n n k
0 uk
k
0
The result is
n n k
yn =
k = 0
b0 a1 un
n n k
= b0 a1 a1
k=0 (8.6)
n+1
n 1 1 a1
= b 0 a 1 ------------------------------------
1 1 a1
n+1
1 a1
= b 0 -----------------------------
1 a1
which is the same result obtained by the direct recursion
ZT y n l ZT x n k
N M
l k
Yz = al z Y z + bk z X z
l=1 k=0 (8.7)
Form the ratio Y z X z = H z
M
k
bk z
b0 + b1 z + + bM z
1 M
k=0
H z = ------------------------------ = ------------------------------------------------------------ (8.8)
1 N
N
l 1 a1 z aN z
1 al z
l=1
The coefficients of the numerator polynomial, denoted B z ,
correspond to the feed-forward terms of the difference equa-
tion
The coefficients of the denominator polynomial, denoted
l
A z , for z l 0 correspond to the feedback terms of the
difference equation
We have used various MATLAB functions that take as input b
and a coefficient vectors, e.g., filter(b,a,...),
freqz(b,a,...), and zplane(b,a)
In terms of the general IIR system we now identify those vec-
tors as
b = b 0 b 1 b M
(8.9)
a = 1 a 1 a 2 a N
0.5
Impulse Response h[n]
1.5
2.5
3
0 1 2 3 4 5 6 7 8 9 10
Time Index (n)
xn wn yn
1 1 b0
z z
wn 1
a1 1 1
z z b1
wn 2
1 1
a2 z z b2
wn 3
Combine common
a3 b3
Az delay blocks
Bz
Shown for N = M = 3
wn
xn yn
1 b0
z
a1 1
z b1
1
a2 z b2
a3 b3
Direct-Form II
xn yn
b0 1
z
The MATLAB b1 a1
function filter() 1
z
implements this
block diagram
b2 1 a2
z
b3 a3
Transposed Direct-Form II
ship
n z 1 -
a u n ------------------
1 (8.14)
1 az
We can use this result to find the z-transform of
n n1
h n = b0 a1 u n + b1 a1 un 1 (8.15)
directly using just linearity and the delay property
1 - 1 1 -
H z = b 0 ---------------------
1
+ b 1 z ---------------------
1
1 a1 z 1 a1 z
1
b0 + b1 z
= -------------------------
1
1 a1 z
We will learn later that we can work this operation in reverse,
and when combined with partial fraction expansion, we will
be able to find the inverse z-transform of almost any rational
Hz
z-Plane
b1 a1
---------
b0
Example: Pole at z =
Consider
1
1 + 0.5z
H z = ------------------------ = z + 0.5
1
z
This system has a pole at z = and a zero at z = 0.5
Example: Second-order H z
Suppose that
1
1 + 0.2z z z + 0.2
H z = ------------------------------------------------ = --------------------------------------
1 2 2
1 1.4z + 0.81z z 1.4z + 0.81
z z + 0.2
= -------------------------------------------------------------------------------------------------
-
z 0.7 + j0.4 2 z 0.7 j0.4 2
j0.680
In polar form the poles are p 1 2 = 0.9e , so the poles
are inside the unit circle and the system is stable
We can check stability using zplane() to plot the poles
and zeros for us
>>> zplane([1 0.2],[1 -1.4 0.81])
0.8
0.6
0.4
Imaginary Part
0.2
0.2
0.4
0.6
0.8
1
1 0.5 0 0.5 1
Real Part
Bandpass
Filter
|H(ej)|
0
3 2 1 0 0.680 1 2 3
2
H(ej)
3 2 1 0 1 2 3
hat()
Lowpass
4
Filter
|H(ej)|
0
3 2 1 0 1 2 3
2
H(ej)
3 2 1 0 1 2 3
hat()
1
Example: H z = 1 1 + 0.8z
Here we have
j 1
H e = --------------------------
-
j
1 + 0.8e
Plotting using freqz() we have
>> w = -pi:(pi/500):pi;
>> H = freqz(1,[1 0.8],w);
6
Highpass
4 Filter
|H(ej)|
0
3 2 1 0 1 2 3
2
H(ej)
3 2 1 0 1 2 3
hat()
3D Surface Plot of H z
Consider the second-order system
1
1 + 0.2z
H z = ------------------------------------------------
1 2
1 1.4z + 0.81z
A 3D surface plot of H z can help clarify how the fre-
quency response is obtained by evaluating H z around the
unit circle
conjugte poles
Unit circle
Second-Order,
Bandpass
H(z)
zeros at 3
z = 0 and
z = -0.2
2
2 Im
1
1
0
0
1 2
1
0
2 1
1
2 Re
z-Transform Relations
z
xn X z
1. ax 1 n + bx 2 n z aX 1 z + bX 2 z
2. x n n0 z n0
z Xz
3. y n = x n * h n z Y z = H z X z
4. n z 1
5. n n0 z n0
z
6. n z 1 -
a un ------------------
1
1 az
p 1 2 = ---------------------------------------------------
3 4 9 16 1 2 = 3--- 1---
21 8 8
1 A1 A2
1 + 2z
H z = --------------------------------------------------- = -------------------
- + -------------------
-
1 1--- z 1 1 1--- z 1 1 1 1 1
1 --- z 1 --- z
2 4 2 4
Solving for A 1
1
1 + 2z 1 1
A 1 = --------------------------------------------------- 1 --- z
2
1 1--- z 1 1 1--- z 1 z = 12
2 4
1
= 1-------------------
+ 2z - = 1-----------
+ 4- = 10
1 1
1 --- z 1 1---
4 1 2
z =2
Solving for A 2
1
1 + 2z 1 1
A 2 = --------------------------------------------------- 1 --- z
4
1 1--- z 1 1 1--- z 1 z = 14
2 4
1
1 + 2z
= 1-----------
+ 8- = 9
= -------------------
-
1 1 12
1 --- z
2 1
z =4
So,
10 9 -
H z = -------------------
- -------------------
1 1 1 1
1 --- z 1 --- z
2 4
Inverse z-transform term-by-term using #6
1 n 1 n
h n = 10 --- u n 9 --- u n
2 4
0
0 2 4 6 8 10 12 14 16 18 20
They agree!
3
h[n] via analysis
0
0 2 4 6 8 10 12 14 16 18 20
Time Index (n)
Example: y n = x n * h n
Find y n for an IIR system having input x n = 2u n and
system function
1
1+z
H z = -------------------------------------
1 1 1 2
1 --- z --- z
6 6
We will first find Y z
From table entry #6 with a = 1
2
X z = ----------------
1
1z
As a result of table entry #3
1
2 + 2z
Y z = X z H z = ----------------------------------------------------------------
1 1 1 2
1 z 1 --- z --- z
1
6 6
1
2 + 2z
= ------------------------------------------------------------------------
-
1 1 1 1
1 z 1 + --- z 1 --- z
1
3 2
We now use a partial fraction expansion over the three real
poles 1, -1/3, and 1/2
A1 A2 A3
Y z = ---------------- + -------------------- + --------------------
1z
1 1 1 1 1
1 + --- z 1 --- z
3 2
Solving for the coefficients
ECE 2610 Signals and Systems 829
The Inverse z-Transform and Applications
1
2 + 2z = 2-----------
+ 2- = 6
A 1 = --------------------------------------------------
-
1 + 1--- z 1 1 1--- z 1 4--- 1---
3 2 3 2
1
z =1
1
2 + 2z
= ------------ = 2---
26
A 2 = -----------------------------------------------
1 1 5 5
1 z 1 --- z
1
4 ---
2 2
1
z = 3
1
2 + 2z 2 + 4 = 18
A 3 = ----------------------------------------------- = ------------- ------
1 1 5--- 5
1 z 1 + --- z
1
1
3 3
1
z =2
Finally,
2 5 - -------------------
6 - ------------------- 18 5 -
Y z = ---------------
1z
1 1 1 1 1
1 + --- z 1 --- z
3 2
and using #6 to inverse transform term-by-term
2--- 1 n 18 1 n
y n = 6u n --- u n ------ --- u n
5 3 5 2
We can check this result using residuez()
>> [A,p,K] = residuez([2 2],conv([1 -1],[1 -1/6 -1/6]))
p = 1.0000e+00
5.0000e-01
-3.3333e-01
K = []
The results agree!
Finally,
2 - -----------------------
1 -
Y z = 1 + -----------------------
1 1
1 + 0.5z 1 0.8z
and
n n
y n = n + 2 0.5 u n 0.8 u n
We can again check this with residuez(); which will
automatically perform long division
>> [A,p,K] = residuez([2 -2.4 -0.4],[1 -0.3 -0.4])
p = 8.0000e-01
-5.0000e-01
0.5
x[n]
0.5
1
5 0 5 10 15 20 25 30 35 40 45 50
Transient Interval X= 40
Y= 22.6556
20
y[n]
20
5 0 5 10 15 20 25 30 35 40 45 50
Time Index (n)
Second-Order Filters
Second-order IIR filters allow for the possibility of complex
conjugate pole and zero pairs, yet still have real coefficients
The general second-order system function is
1 2
b0 + b1 z + b2 z
H z = --------------------------------------------
- (8.20)
1 2
1 a1 z a2 z
The corresponding difference equation is
y n = a1 y n 1 + a2 y n 2
(8.21)
+ b0 x n + b1 x n 1 + b2 x n 2
The direct-form I and direct-form II structures, discussed on
pages 82 and 813 respectively, can be used to implement
(8.21)
The coefficients are related to the roots (poles & zeros) via
b1 b0 = z1 + z2 b2 b0 = z1 z2
(8.22)
a1 = p1 + p2 a2 = p1 p2
1
a1
= cos -
---------------
2 a 2
Impulse Response
Using a partial fraction expansion we can inverse transform
any rational H z back to the impulse response h n
Given
1 2 1 2
b0 + b1 z + b2 z b0 + b1 z + b2 z
H z = --------------------------------------------- = ------------------------------------------------------ (8.23)
1 2 1 1
1 a1 z a2 z 1 p1 z 1 p2 z
we first perform long division to reduce the numerator order
by one
It can be shown that the partial fraction expansion will be of
the form
b2 A1 A2
H z = ----- + ---------------------- + ---------------------- (8.24)
a 2 1 p z 1 1 p z 1
1 2
where
1
Ak = H z 1 pk z
z = pk
A1 A2
H z = -------------------------------- + -----------------------------------
3 j 4 1 3 j 4 1
1 --- e z 1 --- e z
4 4
We know that A 2 = A *1
4 j 3
1 3 + --- e
3+z 3
A 1 = ----------------------------------
- = ---------------------------
3 j 4 1 1+j
1 --- e z
4 1 4 j 4
z = --- e
3
j1.020
= 2.867e
Using the general result of (8.28) we see that = 2.867 ,
= 1.020 , r = 0.75 , and = 4 , so
h n = 2 2.867 0.75 cos --- n 1.020
n
4
A = 1.5000e+00 - 2.4428e+00i
1.5000e+00 + 2.4428e+00i
p = 5.3033e-01 + 5.3033e-01i
5.3033e-01 - 5.3033e-01i
K = []
2
h
2
0 2 4 6 8 10 12 14 16 18 20
They agree!
6
4
[n]
simulation
2
h
2
0 2 4 6 8 10 12 14 16 18 20
Time Index (n)
Frequency Response
j j2
j b0 + b1 e + b2 e
H e = ----------------------------------------------------
- (8.29)
j j2
1 a1 e a2 e
With just a second-order filter we can realize a frequency
response that is lowpass, highpass, bandpass, or bandstop
Idealized filter responses are shown below
Lowpass Highpass
j
He j
He
0 0
Bandpass Bandstop (notch)
He
j
He
j
0 0
With just two poles and two zeros the filter action achievable
is limited
Lowpass/Highpass: Place zeros on the unit circle as a conju-
gate pair and poles inside the unit circle as a conjugate pair
1 2
1 2 cos 1 z + z
H z = -------------------------------------------------------------
- (8.30)
1 2 2
1 2r cos 2 z + r z
z-Plane
1
2
r
z-Plane
0
r
Bandstop (notch):
1 2
1 2 cos 0 z + z
H z = -------------------------------------------------------------
- (8.32)
1 2 2
1 2r cos 0 z + r z
See the final project
0 dB
1
20log 10 H e (dB)
Passband
Transition Band
j
Stopband
50
0
--- ---
3 2
0.8
0.6
0.4
Imaginary Part
0.2
0.2
0.4
0.6
0.8
1
1 0.5 0 0.5 1
Real Part
0
1 dB
dB
20
|H(ej)|
40
50
60
3 2 1 0 1
--- 2 3
3 2
2
H(e )
j
3 2 1 0 1 2 3
hat()
The fifth-order elliptic design has more than met the ampli-
tude response requirements as it achieves the -50 dB gain
level before = 2
The complete H z is
Hz =
1 2 3 4 5
0.01943 + 0.02111z + 0.03771z + 0.03771z + 0.02111z + 0.01943z -
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1 2 3 4 5
1 2.7580z + 4.0110z 3.3711z + 1.6542z 0.3796z