Colorado State University Dept of Electrical and Computer Engineering ECE423 – 1 / 21
Lecture 7 - IIR Filters
James Barnes ([email protected])
Spring 2014
Outline
Colorado State University Dept of Electrical and Computer Engineering ECE423 – 2 / 21
1. IIR Filter Representations – Difference Equations, h[n], H(z)2. IIR Filter Topologies
Lecture 8
1. IIR Filter Design Overview2. REVIEW Analog → Digital Filter Design via Impulse Invariance3. NEW Analog → Digital Filter Design via Bilinear Transformation4. Pre-warping5. Low-pass to High-pass Frequency Transformation
IIR Filter Representations – DifferenceEquations, h[n], H(z)
❖ Outline
IIR FilterRepresentations –Difference Equations,h[n], H(z)
❖ Review - DigitalComputer WiringDiagram
❖ IIR Filter is an LTISystem
❖ IIR Transfer Function❖ Product Form ofTransfer Function❖ Time DomainRepresentation
❖ Time DomainRepresentations (cont’d)
❖ Frequency Response
IIR Filter Topologies
Colorado State University Dept of Electrical and Computer Engineering ECE423 – 3 / 21
Review - Digital Computer Wiring Diagram
Colorado State University Dept of Electrical and Computer Engineering ECE423 – 4 / 21
IIR Filter is an LTI System
Colorado State University Dept of Electrical and Computer Engineering ECE423 – 5 / 21
An IIR filter is one class of linear time-invariant system. We can represent thefunction of the filter as a difference equation:
y[n] = −N∑
k=1
aky[n− k] +M∑
k=0
bkx[n− k] (1)
The first sum represents the ”Auto-Regressive” or IIR part and the second sumrepresents the ”Moving Average” or FIR part. In general, a filter can have eitheror both parts.
Recalling that y[n− k] = z−ky[k], we can write (1) as
{1 +N∑
k=1
akz−k}{y[n]} = {
M∑
k=0
bkz−k}{x[n]} (2)
IIR Transfer Function
Colorado State University Dept of Electrical and Computer Engineering ECE423 – 6 / 21
Equation (2) has the form
A(z){y[n]} = B(z){x[n]} (3)
Taking the z-transform of the sequences x[n] and y[n] in (3), we get
A(z)Y (z) = B(z)X(z) (4)
orA(z)H(z) = B(z). (5)
Therefore
H(z) =B(z)
A(z)=
∑M
k=0bkz
−k
1 +∑N
k=1akz−k
. (6)
Therefore, by choosing ak and bk, we determine the filter frequency response.
Product Form of Transfer Function
Colorado State University Dept of Electrical and Computer Engineering ECE423 – 7 / 21
Another form of the transfer function we will use is the factored or product form:
H(z) = b0
∏M
k=1(1− zkz
−1)∏N
k=1(1− pkz−1)
, (7)
where zk and pk are the pole and zero locations. Since we are concerned withsystems having a real impulse response h[n], the poles and zeros either be realor occur in complex conjugate pairs.
Recall that for a filter to have linear phase, H(z) must satisfy
H(z) = ±z−NH(z−1). (8)
For an IIR filter to satisfy the linear phase condition, both the poles and zeroswould need to have mirror images outside the unit circle of the z-plane. However,poles outside the unit circle ⇒ unstable. Therefore, a causal, stable IIR cannothave linear phase.
Time Domain Representation
Colorado State University Dept of Electrical and Computer Engineering ECE423 – 8 / 21
Taking the inverse z-transform of (4) , we get the standard convolution sum form
N∑
k=0
aky[n− k] =M∑
k=0
bkx[n− k]. (9)
But using the fact that x[n] = δ[n] ⇒ y[n] = h[n], (10) can be written
N∑
k=0
akh[n− k] =
M∑
k=0
bkδ[n− k]. (10)
Time Domain Representations (cont’d)
Colorado State University Dept of Electrical and Computer Engineering ECE423 – 9 / 21
Assuming causality (h[n]=0 for n<0), (9) can be expanded to a series ofequations. Recalling that a0 = 1, the equations are
h[0] = b0,
h[1] = b1 − a1h[0],
. . . . . . . . .
h[M ] = bM − a1h[M − 1]− . . .− aNh[M −N ],
h[M + 1] = −a1h[M ]− a2h[M − 1]− . . .− aN−1h[M −N ]− aNh[M −N − 1].
Note that even though h[n] has a finite length, the impulse response can have an”infinite” duration because of the recursive nature of the equation for y[n].
Frequency Response
Colorado State University Dept of Electrical and Computer Engineering ECE423 – 10 / 21
The frequency response is given by
H(z = ejω ) =B(ejω )
A(ejω )=
∑M
k=0bke
−jωk
1 +∑N
k=1ake−jωk
, (11)
where ω = 2πF/Fs is the relative frequency in radians/sample.
For comparison, the frequency response of an equivalent analog LTI system isgiven by
H(s) =
∑M
k=0βks
k
1 +∑N
k=1αksk
(12)
IIR Filter Topologies
❖ Outline
IIR FilterRepresentations –Difference Equations,h[n], H(z)
IIR Filter Topologies
❖ IIR Filter Topologies –Summary
❖ Direct Type I
❖ Direct Type II
❖ Transposed Type II
❖ Numerical Effects❖ Pole/Zero QuantizationEffects❖ Pole/Zero Quantization- Relation to RoundoffError❖ P/Z Quantization -Relation to RoundoffError(II)
❖ Biquad Section
❖ Pole/Zero Quantizationfor Coupled-FormRealization of 2-PoleSection
Colorado State University Dept of Electrical and Computer Engineering ECE423 – 11 / 21
IIR Filter Topologies – Summary
Colorado State University Dept of Electrical and Computer Engineering ECE423 – 12 / 21
IIR filter topologies can be classified as
● Direct Type I or Type II● Transposed
In addition, filters can be either monolithic or built from cascades of smaller(typically second order) sections
Direct Type I
Colorado State University Dept of Electrical and Computer Engineering ECE423 – 13 / 21
H(z) = H1(z)H2(z) = B(z)1
A(z)(13)
+
+ +
+ +
+ +
+
z -1
z -1
z -1
z -1
z -1z -1
b[0]
b[1]
b[2]
b[M-1]
b[M]
-a[1]
-a[2]
-a[N]
-a[N-1]
x[n] v[n] y[n]
s [1]
s [N]
Properties
● Memory cells: M+N+1● Mpy/Add ops: M+N+1
Direct Type II
Colorado State University Dept of Electrical and Computer Engineering ECE423 – 14 / 21
H(z) = H2(z)H1(z) =1
A(z)B(z) (14)
+
+ +
+ +
+ +
+
z -1
z -1
z -1
b[0]
b[1]
b[2]
b[N-1]
b[N]
-a[1]
-a[2]
-a[N]
-a[N-1]
x[n] y[n]
s1[n]
s2[n]
sN-1[n]
sN[n]
v[n]
Properties
● Memory cells: Greater of [M,N]● Mpy/Add ops: M+N+1
Transposed Type II
Colorado State University Dept of Electrical and Computer Engineering ECE423 – 15 / 21
Transposition Theorem: reverse direction of all signal flow paths, exchange inputand output, and the filter function is unchanged
+
+
+
z -1
z -1
z -1
b[0]
b[1]
b[2]
b[N]
-a[1]
-a[2]
-a[N]
x[n] y[n]
s1[n]
s2[n]
sN[n]
Properties
● Memory cells: Greater of [M,N]● Mpy/Add ops: M+N+1● Fewer adders, but 3 inputs
Numerical Effects
Colorado State University Dept of Electrical and Computer Engineering ECE423 – 16 / 21
Fixed point arithmetic (and to a lesser extent floating point) can cause deviationsfrom ideal behavior because of
● Round-off error in computing sum-of-products expressions● Arithmetic overflow in computing SOP expressions● Arithmetic overflow in filter tap coefficients in adaptive filters● ”Quantization” of pole and zero locations due to finite precision leading to
different frequency dependence than design target.
Pole/Zero Quantization Effects
Colorado State University Dept of Electrical and Computer Engineering ECE423 – 17 / 21
Pole and Zero locations are determined from the ak and bk values. Because offinite precision in fixed-point arithmetic, placement is constrained to a grid ofpoints. Example for a 2-pole system, using 4 bit precision
Pole/Zero Quantization - Relation toRoundoff Error
Colorado State University Dept of Electrical and Computer Engineering ECE423 – 18 / 21
Consider case of ”pole-only” system, with H(z) = 1/A(z) :
H(z) =1
1 +∑N
k=1akz−k
=1
∏N
k=1(1− pkz−k)
. (15)
But because of roundoff error,
ak = ak +∆ak, (16)
where ak is the quantized value and ak is the ”infinite precision” desired value.
If △pi is the error in pole location pi due to quantization, we can compute △pifrom the expression
△pi =
N∑
k=1
∂pi∂ak
△ak. (17)
P/Z Quantization - Relation to RoundoffError(II)
Colorado State University Dept of Electrical and Computer Engineering ECE423 – 19 / 21
But the derivative in (17) can be evaluated as
∂pi∂ak
=(∂A(z)/∂ak)z=pi
(∂A(z)/∂z)z=pi
. (18)
Evaluating the numerator and denominator, we get
△pi = −
N∑
k=1
pN−ki∏N
l=1,l 6=i(pi − pl). (19)
Because of the product term in the denominator, the error term can get large forpoles which are close together. The error can be minimized by breaking up thefilter into sections with poles as far apart as possible.
Typically, the filter is broken up into sections of second-order sections, where thepoles and zeros are chosen to be complex conjugates. These wil not be closetogether, and the error will be minimized.
Biquad Section
Colorado State University Dept of Electrical and Computer Engineering ECE423 – 20 / 21
21
21
]1,2[]1,1[1
]1,2[]1,1[1
zaza
zbzbx[n] y[n]21
21
],2[],1[1
],2[],1[1
zkazka
zkbzkb… 21
21
],2[],1[1
],2[],1[1
zNazNa
zNbzNb
ss
ss…G
Pole/Zero Quantization for Coupled-FormRealization of 2-Pole Section
Colorado State University Dept of Electrical and Computer Engineering ECE423 – 21 / 21
There is also a realization which will at least distribute the pole locations evenlyin the z-plane. This is the coupled-form. The data below are for a two-polesystem with 4 bit coefficient precision as before.