i ir filter
DESCRIPTION
I IR Filter. Signal and System. Filbert H. Juwono. Wireless and Signal Processing (WaSP) Research Group Department of Electrical Engineering University of Indonesia www.ee.ui.ac.id/wasp. State of the art. The basic IIR filter is characterized by the following equation : - PowerPoint PPT PresentationTRANSCRIPT
IIR Filter
Signal and System
Wireless and Signal Processing (WaSP) Research GroupDepartment of Electrical EngineeringUniversity of Indonesia
www.ee.ui.ac.id/wasp
Filbert H. Juwono
www.ee.ui.ac.id/wasp
State of the art
• The basic IIR filter is characterized by the following equation :
• Where h(k) is the impulse response of the filter which is theoretically infinite in duration
M
kk
N
kk
k
knyaknxbny
knxkhny
00
0
)()()(
)()()(
www.ee.ui.ac.id/wasp
• bk and ak are the coefficients of the filter • x(n) and y(n) are the input and output to the filter• Transfer function for the IIR filter is :
M
k
kk
N
k
kk
MM
NN
za
zb
zazazbzbbzH
0
01
1
110
1...1...)(
www.ee.ui.ac.id/wasp
1 2
1 2
N
M
K z z z z z zH z
z p z p z p
1 2
1 2
, ,, ,
z z zerosp p poles
Zeros are those values of z which H(z) becomes zeroPoles are values of z for which H(z) is infinite
www.ee.ui.ac.id/wasp
• The important thing is to find suitable values for the coefficients bk and ak
• Note that the current output y(n) is a function of the past outputs y(n-k) . So that it show the feedback system of some sort
• The strength of IIR filters comes from the flexibility the feedback arrangement provides
• Remember that the transfer function of IIR filter can be shown as the pole and zero equations
www.ee.ui.ac.id/wasp
• For frequency selective filters, such as lowpass and bandpass filters, the frequency response specifications are often in the form of tolerance scheme
• Here is an example tolerance scheme for an IIR bandpass filter
www.ee.ui.ac.id/wasp
ε2 : passband ripple parameterδp : passband deviationδs : stopband deviationfp1 and fp2 : passband edge frequencyfp1 and fp2 : stopband edge frequencyAp : passband ripple = 10. log10(1+ ε2) = 20. log10(1- δp)As : stopband attenuation = -20. log10(δs)The band edge frequencies are sometimes given in normalized form, that is a fraction of the sampling frequency sf F
www.ee.ui.ac.id/wasp
Coefficient calculation methods for IIR filters
There are 4 methods to calculate the coefficients :1. Pole-zero placement2. Impulse invariant3. Matched z-transform4. Bilinear z-transform
Learn carefully
www.ee.ui.ac.id/wasp
Pole-zero placement Method
• The idea is : when a zero is placed at a given point on the z-plane,
the frequency response will be zero at the corresponding point
while a pole produces a peak at the corresponding frequency point
• Note that for the coefficient of the filter to be real, the poles and zeros must either be real
www.ee.ui.ac.id/wasp
www.ee.ui.ac.id/wasp
Example
• A bandpass digital filter which is required to meet the following specifications :
- complete signal rejection at dc and 250 Hz - a narrow passband centered at 125 Hz - a 3dB bandwidth of 10 HzAssume the sampling frequency of 500 Hz
www.ee.ui.ac.id/wasp
SolutionFist we must determine where to place the poles and zeros on the z-plane . Watch the frequency on 250 Hz and 125 Hz
Zeros are at angles of 0o and 360o x 250/500 = 180o
and the place poles at +- 360o x 125/500 = +-90o
The radius, r, of the poles is determined by the desi-red bandwidth. An approximate relationship betweenr , for r > 0.9 and bandwidth bw is given by :r = 1 – (bw/Fs).π So that, by substituting the value of bw=10 Hz and Fs=500 Hz , giving r = 0.937After it, we can draw the pole-zero diagram below :
www.ee.ui.ac.id/wasp
www.ee.ui.ac.id/wasp
From the pole-zero diagram, the transfer function can be written as follow :
/ 2 / 2
2
2
2
2
( 1)( 1)( )( )( )
10.8779691
1 0.877969
j j
z zH zz re z re
zz
zz
www.ee.ui.ac.id/wasp
So that, the difference equation is :
Look at again the transfer function. It shows filter which is a second-order section, with coefficients :
b0 = 1 a1 = 0b1 = 0 a2 = 0.877969b2 = -1
)2()()2(877969.0)( nxnxnyny
www.ee.ui.ac.id/wasp
Converting analogue filters into equivalent digital filters
• This represents the most successful approach of obtaining the coefficients of IIR filters
• Two common approaches:– The impulse invariant– The matched z-transform– The bilinear z-transform
www.ee.ui.ac.id/wasp
Impulse Invariant Method
• First, consider these component : - H (s) : a suitable analog transfer function - h (t ) : the impulse response - h (nT) : z transforming with T sampling interval - H (z) : desired transfer function• Those component are useful and obtained by using
Laplace Transform and also z-transformation
www.ee.ui.ac.id/wasp
Illustrating The Impulse Invariant Method
• Digitize, using the impulse invariant method, the simple analogue filter with the transfer function given by:
CH ss p
1 1 ptCh t L H s L Ces p
www.ee.ui.ac.id/wasp
• The impulse response of the equivalent digital filter
pnTt nTh nT h t Ce
• The transfer function of H(z) is obtained by z-transforming h(nT)
1
0 0
11
n pnT
n n
pT
H z h nT z Ce z
Ce z
www.ee.ui.ac.id/wasp
• We can write
11 pT
C Cs p e z
• So
11 11 K
M MK K
p TK KK
C Cs p e z
www.ee.ui.ac.id/wasp
• For the case when M = 2
1 2
2 1
1 21 2
1 2 1 21 1
1 2
11 2 1 2
1 2
1 1
1
p T p T
p T p T
p p Tp T p T
C C C Cs p s p e z e z
C C C e C e z
e e z e z
• If the poles are conjugates, then
*
1 1
1*1 1
21 1 21
2 cos sin 21 1 2 cos1
r
r r
p Tr r i i i
p T p T p Tp Ti
C C pT C pT e zC Ce z e pT z e ze z
www.ee.ui.ac.id/wasp
Here are the steps in Impulse Invariant Method :1. Determine a normalized analog filter H(s) that
satisfies the specifications for the desired digital filter
2. If necessary, expand H(s) using partial fraction to simplify the next step
3. Obtain the z-transform of each partial fraction to obtain :
M
KTpK
M
K K
K
zeC
psC
k1
11 1
www.ee.ui.ac.id/wasp
4. Obtain H(z) by combining the z-transforms of the partial fractions into second-order terms and possibly one-first-order term.
If the actual sampling frequency is used then multiply H(z) by T
www.ee.ui.ac.id/wasp
Example
• It is required to design a digital filter to approximate the following normalized analogue transfer function
2
12 1
H ss s
Assumed a 3 dB cutoff frequency of 150 Hz and a sampling frequency of 1.28 kHz
www.ee.ui.ac.id/wasp
Solution
• We need to scale the normalized transfer function
• This is achieved by replacing s by s/α, where
• Thus2 150 942.4778
2
1 22 2
1 2
'2s s
C CH s H ss p s ps s
www.ee.ui.ac.id/wasp
1
2 1666.4324 1
2j
p j
*2 1p p
1 666.43242
C j j *
2 1C C
0rC 666.4324iC
0.5207iPT 0.5207rPT
0.5941rPTe sin 0.4974iPT
cos 0.8675iPT 2 0.3530rPTe
www.ee.ui.ac.id/wasp
1
1 2
393.92641 1.0308 0.3530
zH zz z
To keep the gain down and to avoid overflows when the filter is implemented, it is common to multiply H(z) by T or divide it by the sampling frequency
1
1 2
0.30781 1.0308 0.3530
zH zz z
0 0a
1 0.3078a 1 1.0308b
2 0.3530b
www.ee.ui.ac.id/wasp
Matched z-transform (MZT) method
• It provides a simple way to convert an analog filter into an equivalent digital filter
• The idea is : each of the poles and zeros of the analog filter is mapped directly from the s-plane to the z-plane using the following equation :
• It maps a pole or zero at the location s=a in the s-plane, onto a pole or zero in the z-plane at z=eaT
)1()( 1 aTezas
www.ee.ui.ac.id/wasp
1 2
1 2
M
N
s z s z s zH s
s p s p s p
1( ) (1 )kz Tks z z e
1( ) (1 )kp Tks p z e
1 2
1 2
1 2 cos1 2 cos
r r
r r
z T z Ti
p T p Ti
e z T z e ze pT z e z
In case where M = N =2 and the poles and zeros are conjugates
www.ee.ui.ac.id/wasp
• Having a filter with a 3 dB cutoff frequency of 150 Hz in sampling frequency of 1.28 kHz. The normalized of transfer function of an analog filter is given by :
Example
121)(
2
sssH
www.ee.ui.ac.id/wasp
The cutoff frequency may be expressed as ωc=2π x 150 = 942.4778 rad/s . The transfer function ofthe denormalized analog filter is obtained by repla-cing s by s/ωc :
22
2
2
)()('
cc
c
css
ss
sHsH
Find poles byabc formula
www.ee.ui.ac.id/wasp
Remember : so that :
We have the real and imaginary poles :
jjp
p
ci
cr
43.66622
43.66622
2
124
2b b acs
a
www.ee.ui.ac.id/wasp
Then, prT = -0.52065 cos (piT) = 0.8675 piT = +0.52065 e prT = 0.5941
The transfer function become :
21
5
594134.0030818.11108876.8)(
zzzH
www.ee.ui.ac.id/wasp
Bilinear z-transform (BZT) Method
• It is the most important method• The idea is: to convert an analog filter H(s) into an
equivalent digital filter is to replace s as follow:
• That transformation maps the analog transfer function, H(s), from the s-plane into the discrete transfer function, H(z), in the z-plane
Tkork
zzks 21,
11
www.ee.ui.ac.id/wasp
• Look at the figure below. It shows the transforma-tion using BZT method
S-plane Z-plane
www.ee.ui.ac.id/wasp
• Direct replacement of s in H(s) may lead to a digital filter with undesirable response
• We find that the analogue frequency ω’ and the digital frequency ω are related as
• We can see that ω’ and ω are almost linear for small values of ω, but becomes not linear for large values of ω, leading to distortion (warping)
2' tan , 1 or 2Tk k k
T
www.ee.ui.ac.id/wasp
This effect is compensated by prewarping tha analogue filter before applying the bilinear transformation
www.ee.ui.ac.id/wasp
• Here are the steps for using BZT1. Use the digital filter specifications to find suitable
normalized, prototype, analog low pass filter H(s)2. Determine and prewarpe the bandedge or critical
frequencies of the desired filter when : ωp = specified cutoff frequency ωp’ = prewarped cutoff frequency
www.ee.ui.ac.id/wasp
Remember that in bandpass and bandstop filter, there are the lower and upper passband edge frequencies or we can say ωp1’ and ωp2’ .
3. Denormalize the analog prototype filter by replacing s in the transfer function, H(s), using these following transformation :
2tan'
Tpp
1'1 tan
2p
p
T
2'2 tan
2p
p
T
www.ee.ui.ac.id/wasp
lowpass to lowpass
lowpass to highpass
lowpass to bandpass
lowpass to bandstop2
02
20
2
'
'
sWss
Wsss
ss
ss
p
p
121220 '''' pppp W
www.ee.ui.ac.id/wasp
4. Apply the BZT to obtain the desired digital filter transfer function, H(z), by replacing s in the frequency-scaled (i.e. denormalized) transfer function, H’(s) as follows
11
zzs
www.ee.ui.ac.id/wasp
Example
• Determine the transfer function and the difference equation for the digital equivalent of the analogue lowpass filter transfer function
• Assume a sampling frequency of 150 Hz and a cutoff frequency of 30 Hz
11
H ss
www.ee.ui.ac.id/wasp
Solution
• The critical frequency
2 30 /p rad s
• The cutoff frequency after prewarping
' tan 2p pT
• With T = 1/150 Hz, so ' tan 5 0.7265p
www.ee.ui.ac.id/wasp
• Denormalized analogue filter
0.72651 0.7265'
0.7265 1 0.7265s sH s H ss s
1 1
1
1
0.7265 1'
1 0.7265 0.7265 1
0.4208 1
1 0.1584
s z z
zH z H s
z
z
z
• The difference equation 0.1584 1 0.4208 1y n y n x n x n
www.ee.ui.ac.id/wasp
• When it transfers into highpass filter
' '
1'1 0.7265ps s
p
sH s H ss s
1 1
1 1'
1 1 0.7265s z z
z zH z H s
z z
• Simplifying
1
1
10.57921 0.1584
zH zz
www.ee.ui.ac.id/wasp
Classical Analog Filter
• There are four types of Classical Analog filter :1. Butterworth filter2. Chebysev type I3. Chebysev type II4. Elliptic• All types of filter are derived from lowpass prototype
filter
www.ee.ui.ac.id/wasp
Butterworth Filter
Here is sketch of frequency response on Butterworth filter
www.ee.ui.ac.id/wasp
• The important equations on Butterworth filter are :
22
log 1 11( ')'' 2 log1 ''
sN
s
pp
H N
Magnitude squareFrequency response Filter order
www.ee.ui.ac.id/wasp
• Butterworth filter contains zero at infinity and poles:
2 1 2 2 1 2 1cos sin 1, 2,...,
2 2j k N N
k
k N k Ns e j k N
N N
www.ee.ui.ac.id/wasp
n1
2
3
4
5
6
7
8
1s
2 2 1s s
2 1 1s s s
2 20.76536 1 1.84776 1s s s s
2 21 0.6180 1 1.6180 1s s s s s
2 2 20.5176 1 2 1 1.9318 1s s s s s s
2 2 21 0.4450 1 1.2456 1 1.8022 1s s s s s s s
2 2 2 20.3986 1 1.1110 1 1.6630 1 1.9622 1s s s s s s s s
Butterworth polynomials, normalized
www.ee.ui.ac.id/wasp
Chebysev Filter
• Chebysev Type I : equal ripple in the passband, monotonic in the stopband
• Chebysev Type II : equal ripple in the stopband, monotonic in the passbandChebysev Type I
2
2 2'
1 ' 'N p
KHC
Chebyshev polynomial which exhibits equal ripple in the passband
Determine the passband ripple
www.ee.ui.ac.id/wasp
2passband ripple 10log 1 20log 1 p
stopband attenuation 20log s
1
1
coshcosh ' 's p
N
1 221 1s
The poles of the normalized Chebyshev
sinh cos cosh sink k ks j
11 1sinhN
2 1 1, 2,...,
2k
k Nk N
N
www.ee.ui.ac.id/wasp
Here is sketch of frequency response on Chebysev
Type 1 Type 2
www.ee.ui.ac.id/wasp
Elliptic Filter
• The elliptic filter exhibits equiripple behavior in both the passband and the stopband
• This is the following magnitude-squared response:
• GN(ω’) is a Chebysev rational function
2
2 2( ')1 ( ')N
KHG
www.ee.ui.ac.id/wasp
Here is sketch of frequency response on Elliptics
www.ee.ui.ac.id/wasp
The critical frequencies: 0, 1, ' 's p
www.ee.ui.ac.id/wasp
www.ee.ui.ac.id/wasp
www.ee.ui.ac.id/wasp
www.ee.ui.ac.id/wasp
www.ee.ui.ac.id/wasp
www.ee.ui.ac.id/wasp
Example
• Obtain the transfer function of a lowpass digital filter meeting the following specifications:– Passband 0 – 60 Hz– Stopband > 85 Hz– Stopband attenuation > 15 dB
Assume a sampling frequency of 256 Hz and a Butterworth characteristic
www.ee.ui.ac.id/wasp
Solution
• This illustrates how to combine steps 4 and 5 in the BZT process
• The critical frequencies1
12 2 60 2 0.2344
256s
fTF
22
2 2 85 2 0.3320256s
fTF
www.ee.ui.ac.id/wasp
• The prewarped equivalent analogue frequencies
• We need to obtain H(s) with Butterworth characteristics, a 3 dB cutoff of 0.906347 and a response at 85 Hz that is down by 15 dB
11
22
' tan 0.9063472
' tan 1.715802
T
T
www.ee.ui.ac.id/wasp
• For attenuation 15 dB and a passband ripple of 3 dB we get N = 2.68. We use N = 3.
• A normalized third order filter
22
1 2
1 1 11 11 2 1
H ss s ss s
H s H s
1 2 0.2344cot cot 1.1031552 2T
www.ee.ui.ac.id/wasp
• Performing transform
• Combining
12 2 cot 2 1 1
1 2
1 2
1 20.30121 0.1307 0.3355
s T z zH z H s
z zz z
1
1 1
10.47541 0.0490
zH zz
1 2 3
1 2 1 2 3
1 3 30.14321 0.1801 0.3419 0.0165
z z zH z H z H zz z z