here - School of Physical Sciences

advertisement
PS403 - Digital Signal processing
6. DSP - Recursive (IIR) Digital Filters
Key Text:
Digital Signal Processing with Computer Applications (2nd Ed.)
Paul A Lynn and Wolfgang Fuerst, (Publisher: John Wiley & Sons, UK)
We will cover in this section
Infinite Impulse Response (FIR) filter design
Infinite Impulse Response (Recursive) Digital Filters
Where FIR filters are non-recursive, I2R filters are recursive
We already know that I2R filters depend on previous outputs y[n-m],
M = 1, 2, 3, … and current/previous values of the input x[n-m], m=0,1,..
We also know that they are concomitantly more computationally
efficient than FIR filters and so why don’t we just recast all FIR filters
as IIR filters which can have 100s of coefficients ?
Answer:
1.  Recursive filters can become unstable at particular frequencies
if poorly designed
2.  Recursive designs do not generally yield zero/linear phase
characteristics
Infinite Impulse Response (Recursive) Digital Filters
Design Method 1
We follow a procedure much the same as that outlined in chapter 4.
We place poles and zeros at locations where we infer that the
frequency response will be close to the desired one Bit ‘hit and miss’ though !
As before we evaluate |H(Ω)| using a computer code.
% n= M
(
' ∏{exp( jΩ) − Z n }*
n= 0
*
H (Ω) = K.' n=
' N
*
' ∏{exp( jΩ) − Pn } *
& n= 0
)
Infinite Impulse Response (Recursive) Digital Filters
As before |H(Ω)| can be built form a superposition of 1st and 2nd
Order systems (transfer functions) - Cascade Canonic Form
i.e, we assess individually the effect of each pole and zero on |H(Ω)|
Case 1. Real poles and zeros
A real pole at Z = α will contribute to H(Ω) a factor:
F1 (Ω) = {exp( jΩ) − α }
= (CosΩ − α ) + jSinΩ
€
Infinite Impulse Response (Recursive) Digital Filters
So the magnitude transfer function for the filter becomes:
F1 (Ω) = {1− 2αCosΩ + α
2 1/ 2
}
F1 in this case contributes to the denominator of |H(Ω)| or H(Ω).
€
A real zero @ Z=α makes and identical contribution to the numerator
of |H(Ω)| or H(Ω) and an nth order pole or zero yields a corresponding
contribution raised to the power of ‘n’.
Infinite Impulse Response (Recursive) Digital Filters
Case 2. Complex conjugate poles or zero pairs
As before we use a polar coordinates (r, ±θ).
A pole pair at (r, ±θ) yields a factor:
F2 (Ω) = {exp( jΩ) − r exp( jθ )}.{exp( jΩ) − r exp(− jθ )}
= exp(2 jΩ) − 2rCosθ exp( jΩ) + r
to the denominator of H(Ω). The magnitude or gain part of the frequency
transfer function can be written as before:
€
€
€
2
{
F2 (Ω) = (Cos2Ω − 2rCosθCosΩ + r
2 2
1/ 2
) + (Sin2Ω − 2rCosθSinΩ) }
2
Infinite Impulse Response (Recursive) Digital Filters
Complex conjugate zero pairs make similar contribution to the
numerator of H(Ω)
As before the poles and zeros of H(Z); Pn and Zn gives:
K.( Z − Z1 )( Z − Z 2 )( Z − Z 3 )........
H (Z ) =
(Z − P1 )( Z − P2 )(Z − P3 ).......
Using
€
Z → exp( jΩ); H ( Z ) → H (Ω)
Yielding the spectrum of the I2R filter
€ ) − Z1 )(exp( jΩ) − Z 2 )(exp( jΩ) − Z 3 )........
€H ( Z ) = K.(exp( jΩ
H(Ω)
(exp( jΩ) − P1)(exp( jΩ) − P2 )(exp( jΩ) − P3 ).......
Infinite Impulse Response (Recursive) Digital Filters
The trick is to obtain a HA(Ω) as close as possible to the HD(Ω)
with as few Z=plane poles and zeros as possible. As we know
poles and zeros located close to the unit circle yield sharp peaks
and nulls in the frequency transfer function H(Ω).
Program no. 20 evaluate filter responses using the cascade
Canonic form from user specified values of ‘α’ or (r, ±θ),
|F1(Ω)| and |F2(Ω)| respectively. From products of these 1st and
2nd order transfer functions the overall H(Ω) is computed.
Cf: Figure 6.1
(a) 
(b) 
(c) 
(d) 
Real Pole; a = 0.9, i.e. @ Z = 0.9
Real 2nd order zero @ Z=-0.8, i.e., a cascaded LPF
A complex conjugate pole pair at r = 0.975, θ = ±150O
A complex conjugate zero pair at r = 1.000, θ = ±50O
Infinite Impulse Response (Recursive) Digital Filters
Multiplying each of the frequency responses (or gains) in
Figure 6.1a,b,c,d yields the total gain curve - Figure 6.2b
The composite pole-zero plot is shown in Figure 6.2a
Example - Graphical method for IIR filter design.
Design a bandpass filter with centre frequency Ω0 = π/2
and bandwidth 2Ω1 = π/40 @ -3dB points.
It must also have zero gain at Ω=0 & π.
For centre frequency Ω0 = π/2 we place complex conjugate
pole pairs close to r =1 and θ = 900. At the -3dB points the
gain |H(Ω)| must have dropped to 0.707 by definition.
Infinite Impulse Response (Recursive) Digital Filters
|H(Ω)|
1
0.707
π/2
π/40
C
d A
(1-r)
x
r
0
At the -3dB points
the gain is 0.707
Ω
B
Place a pole a
distance ‘r’ from the
Origin so that the
pole lies a distance
‘1-r’ from the unit
circle
Infinite Impulse Response (Recursive) Digital Filters
Consider a pole located a distance ‘r’ from the origin of the unit circle
and lying on the positive y-axis. The shortest distance to the unit circle
is ‘1-r’ (Point A) and corresponds the point of peak gain (response).
The points ‘B’ and ‘C’ are chosen to lie at angular positions of
ΔΩ = ±π/80 on either side of the vertical axis ! Points ‘B’ and ‘C’ are
also chosen to yield a pole vector that is √2 times ‘1-r’. In this way
we ensure that the gain at points B and C drops to 0.707 or -3dB.
Note that as the pole gets closer to the unit circle, ‘1-r’ decreases,
therefore ‘d’ decreases and as a result the bandwidth 2Ω1 decreases.
Infinite Impulse Response (Recursive) Digital Filters
C
d A d
(1-r)
B
x
2
d 2 + (1− r) = 2 (1− r)
€
0
2Ω1
Bandwidth 2Ω1 corresponds to a distance ‘2d’ along the unit circle.
In order that pole length is √2 times ‘1-r’, we require that
|AX| = |AB| = |AC| or in other words d = 1-r
So 2Ω1 (radians) = 2d/radius of unit circle = 2d.
Therefore 2Ω1 =2 (1 - r) radians which in turn means that
2 (1 - r) = π/40 and hence r = 0.96 !
Infinite Impulse Response (Recursive) Digital Filters
Finally we require true nulls |H(Ω)| at Ω = 0 and π ,
i.e., we place zeros at Z = +1 and Z = -1
Im
x
Z-Plane
Re
x
Placing the above pole-zero values into Program 20, the maximum gain
Equals 26.15.
So we set K = 1/(26.15) or K = 0.03824 for unity gain at Ω = π
Infinite Impulse Response (Recursive) Digital Filters
So we can immediately write down the Z-T for the filter as:
Y (Z )
0.03824 ( Z −1)( Z + 1)
H (Z ) =
=
X ( Z ) {Z − 0.961exp( j π2 )}{Z − 0.961exp(− j π2 )}
=
€
0.03824 ( Z 2 −1)
Z 2 + 0.9235
⇒ y [ n + 2] + 0.9235y [ n ] = 0.03824{ x [ n + 2] − x [ n ]}
€
⇒ y [ n ] = −0.9235y [ n − 2] + 0.03824{ x [ n ] − x [ n − 2]}
€
€
|H(Ω)| for this filter is plotted on figure 6.4(b) - Evaluate h[n] !!
Infinite Impulse Response (Recursive) Digital Filters
Example 6.2: Narrow band ‘Notch’/ ‘Band-Reject’ filter
Ζ1
P1
Im
Z
Z-Plane
x
x
Ω
Re
Ω0
Notice that for most values of Ω, vector magnitudes |Z1| ~ |P1|
And so the gain |H(Ω)| ~ unity !! However in the vicinity of Ω = Ω0 the
Zero vector becomes much shorter than the pole vector and hence
|H(Ω)| becomes sharply peaked with a zero gain at Ω = Ω0
Infinite Impulse Response (Recursive) Digital Filters
Take the EKG example from Chapter 1 We wish to reject the 50 Hz mains interference in a system where
The sampling rate is 1kHz and hence 50 Hz = 20 samples/cycle.
Need a bandstop filter with a -3dB bandwidth, 2Ω1 = 10 Hz.
For an adequately sampled signal;
Ω = π = 2 samples/ cycle
⇒ π = 500 Hz and hence Ω0 = 50 Hz = 0.1 π
2(1− r) 10
π
=
,∴
r
=
1−
= 0.96858
From before we have then that:
π
500
100
Zeros at (r, ± θ) = (1.00000, ±0.1 π)
€ ±0.1 π)
Poles at (r, ± θ) = (0.96858,
Infinite Impulse Response (Recursive) Digital Filters
So the corresponding Z-transform of the impulse response for
Such a Notch filter is:
Z − exp( j 10π )}{Z − exp(− j 10π )}
Y (Z )
{
H (Z ) =
=
X ( Z ) {Z − 0.96858exp( j π2 )}{Z − 0.96858exp(− j 10π )}
Z 2 − 2ZCos( 10π ) + 1
= 2
Z −1.93716ZCos( 10π ) + 0.93815
€
Z 2 −1.9021Z + 1
= 2
Z −1.84239 + 0.93815
€
⇒ y [ n + 2] −1.84239y [ n + 1] + 0.93815y [ n ] = x [ n + 2] −1.9021x [ n + 1] + x [ n ]
⇒ y [ n€
] = 1.84239y [ n −1] − 0.93815y [ n − 2] + x [n ] −1.9021x [n −1] + x [ n − 2]
€
Infinite Impulse Response (Recursive) Digital Filters
⇒ y [ n ] = 1.84239y [ n −1] − 0.93815y [ n − 2] + x [ n ] −1.9021x [ n −1] + x [ n − 2]
€
This should look familiar look back at Figure 1.4.
Coefficients almost exactly the same.
So we end where we started !!
Infinite Impulse Response (Recursive) Digital Filters
⇒ y [ n ] = 1.84239y [ n −1] − 0.93815y [ n − 2] + x [ n ] −1.9021x [ n −1] + x [ n − 2]
€
This should look familiar look back at Figure 1.4.
Coefficients almost exactly the same.
But not quite….!!
Filters derived from Analog Filter Designs
•  Analog filter design goes back to before the 1930s
•  As a result there exists a wealth of designs that one
could mine in order to make digital equivalents that
would carry over their particular physical features into
the digital domain
•  We know that the fundamental operation and
characteristics of analog circuits and systems are
usually described by a differential equation
•  We also know that such systems are by definition
continuous with continuous variables like V, I & t…
Filters derived from Analog Filter Designs
•  We also know that we can transform such differential
equations into polynomial expressions of the
continuous variable ‘s’ using the Laplace Transform
•  So we can write the transfer function for any filter as the
Laplace Transform of its impulse response, i.e., H(s)
•  We know, by analogy with the Z-Transform for a filter,
the H(s) will in general be a ratio of two polynomials in
‘s’
•  So we can write H(s) as......................
Filters derived from Analog Filter Designs
•  Apart from the gain factor ‘K’ one can see that, just like
the Z-Transform, the analog filter is characterised by
‘zeros’ and ‘poles’ in the complex s-plane...
•  We know that s = jω where ω is the contunous quantity
angular frequency and can take any value from 0 - ∞
•  It is also clear that H(s) has a similar form to H(Z)....
•  We also know that Z = jΩ where Ω is in units of radians
or samples per cycle and can take any value from 0 - π
Filters derived from Analog Filter Designs
•  So if we want to transform an analog filter characterised
by H(s) into a digital filter characterised by H(Z) we
need to be able to find a function that can take the
infinite angular frequency range 0 < ω < ∞ and
compress it into the finite range angular (sample/cycle)
range 0 < Ω < π
•  The transformation which permits us to do so is the socalled Bilinear Transformation given by:
Filters derived from Analog Filter Designs
•  So the BL has a zero at Ω = 0 rads and a pole at π rads
•  To see how it might be useful in converting a H(s) to a
H(Z) take a look at its Fourier Transform by letting Z -> ejΩ
•  Which we can rewrite as:
Filters derived from Analog Filter Designs
•  So finally we can write:
•  So we se that F(Ω) is purely imaginary and is periodic
•  The magnitude of F(Ω) varies from 0 è ∞ as Ω varies
from 0 – π
Filters derived from Analog Filter Designs
•  Now imagine that the Laplace Transform (LT) for a
desirable analog filter is given by:
•  The Fourier Transform (FT) is given by:
•  And the complete response curve (transmission) is
obtained by letting ω vary from 0 to ∞
Filters derived from Analog Filter Designs
•  If you substitute jω by jTan(Ω) exactly the same values of
H(ω) will be obtained if now you let Ω vary from 0 to π
•  That is to say the BL transformation will yield a digital filter
H(Ω) with a response (transmission) over the range:
0<Ω<π
which reproduces that of an analog filter over the range:
0<ω<∞
Filters derived from Analog Filter Designs
Example: Butterworth and Chebychev filters......
•  These can be low pass, high pass or bandpass filter
•  As before an ideal filter has unity transmission in the pass
band, zero transmission in the stopband(s) and infinitely
narrow transition(s) from pass to stop bands.....
•  The Butterworth filter approximates this ideal with what is
called a ‘Maximally Flat’ pass band characteristic (Fig. 6.6)
•  For example, for a low pass filter, the Butterworth filter
pass band gain falls off gradually with increasing ω,
dropping to 1/√2 (-3bB) at ω = ω1
Filters derived from Analog Filter Designs
The Butterworth filter frequency transfer function magnitude
is given by:
The related Chebychev (equi-ripple type) filter has a
frequency transfer function given by the expression:
Filters derived from Analog Filter Designs
•  Where ω1 is the nominal ‘cutoff’ frequency
•  The passband ripple δ = 1 – (1 + ε2)-1/2
•  The zero and first order Chebychev polynomials are
given by:
C0(x) = 1 and C1(x) = x
•  Second and higher order Chebychev polynomials are
computed by evaluating:
Cn(x) – 2xCn-1(x) – Cn-2(x)
Filters derived from Analog Filter Designs
So, in principle we should now be able to make their digital
counterparts by replacing jω by F(Ω) = j Tan (Ω/2) in the
Laplace Transform H(s) for each filter type..
This means that we substitute ω by Tan (Ω/2) in H(ω) for
each filter....
Note that the relationship between ω and Ω is clearly non
linear in this transformation and so sweeping along the Ω
axis for the digital filter leads to a ‘warping’ of the ω scale
Substituting ω by Tan (Ω/2) in H(ω) we get.........
Filters derived from Analog Filter Designs
Digital Butterworth (Magnitude) Transfer Function:
Digital Chebychev (Magnitude) Transfer Function:
Filters derived from Analog Filter Designs
•  All that remains is to find that Z-plane poles and zeros so
that the difference equations for each digital filter can be
derived and applied.
•  These are not trivial and will have to be written into
computer code for calculation and application
•  A Butterworth low pass digital filter of nth order has n
poles arranged on a circular locus in the Z (Complex)
plane and a nth order zero at Z = -1
•  The (complex) poles (Pm) are given by those values of Pm
that lie within the unit circle and are given by the following
expression for the real and imaginary parts:
Filters derived from Analog Filter Designs
For the Butterworth filter:
Where m = 0, 1, 2, ..............(2n – 1)
Note: For ‘n’ even, (mπ/n) is replaced by (2m + 1) π/2n
Filters derived from Analog Filter Designs
For the Chebychev filter:
Where m = 0, 1, 2, ..............(2n – 1)
Note: For ‘n’ even, (mπ/n) is replaced by (2m + 1) π/2n
Filters derived from Analog Filter Designs
So in practice you would have to write a code to determine
the Z-plane poles and zeros
From these you can construct H(Z) for the Butterworth or
Chebychev filter
You can then determine the filter difference equation:
Y[n] = f(x[n])
You can now compute the output y[n] for any arbitrary
input signal (data) x[n] for a digital version of two
wellestablished analog filter types
You can repeat for any analog filter by computing its H(s)
from the differential equation describing its behaviour.......
Go now and extend your knowledge of
DSP to non-linear, adaptive, statistical,..
Design
Build
Apply
Innovative
in basic sciences, industrial processes,
data products, finance and associated
companies and enterprises…..
Download