eleg--305: digital signal processing - university of...
TRANSCRIPT
ELEG–305: Digital Signal ProcessingLecture 23: Design of Digital IIR Filters (Part II)
Kenneth E. Barner
Department of Electrical and Computer EngineeringUniversity of Delaware
Fall 2008
K. E. Barner (Univ. of Delaware) ELEG–305: Digital Signal Processing Fall 2008 1 / 25
Outline
1 Review of Previous Lecture
2 Lecture Objectives
3 Design of IIR Filters from Analog FiltersCharacteristics of Commonly Used Analog FiltersButterworth FiltersAnalog Filters Comparison
4 Frequency TranslationFrequency Transformations in the Analog DomainFilter Design Steps & Examples
5 IIR Filter Design Using Matlab
K. E. Barner (Univ. of Delaware) ELEG–305: Digital Signal Processing Fall 2008 2 / 25
Review of Previous Lecture
Review of Previous LectureIIR Filter Design – Map well understood analog filters to thediscrete domain (s to z plane mapping)Approximation of Derivatives Method for IIR Filter design –
z =1
1− sTs =
1− z−1
TMaps s LHP to right half of z unit circle; No highpass filtersImpulse Invariance Method for IIR Filter design – z = esT ; Maps sLHP to inside of z unit circle; T small to avoid aliasing; poles &zeroes have different mappingsBilinear Transformation Method for IIR Filter design –
s =2T
(1− z−1
1 + z−1
)z =
1 + T2 s
1− T2 s
Ω =2T
tan (ω/2) ω =2 arctan (ΩT/2)
Maps s LHP to inside of z unit circle; No aliasingK. E. Barner (Univ. of Delaware) ELEG–305: Digital Signal Processing Fall 2008 3 / 25
Lecture Objectives
Lecture Objectives
Objective Analyze analog filter families that can be mapped todiscrete IIR filters; Develop analog filter design methods;Present frequency translation methods for transformingfilter types; Present Matlab IIR filter design routines
Reading Chapters 10 (10.3–10.4); Next lecture, multirate signalprocessing (Chapter 11)
K. E. Barner (Univ. of Delaware) ELEG–305: Digital Signal Processing Fall 2008 4 / 25
Design of IIR Filters from Analog Filters Characteristics of Commonly Used Analog Filters
Objectives: Design an analog filter and perform a H(s) to H(z)conversion that preserves filter characteristics
Only lowpass analog filters considered – frequency translationconverts lowpass prototypes to high, band, stop/pass filtersConsider several lowpass analog filters with different pass/stopband characteristics
Aside: Ωc is defined as the -3 dB, or cutoff, frequency of H(s), i.e.,
|H(Ωc)|dB = 20 log |H(Ωc)| = 10 log |H(Ωc)|2 = 10 log(0.5) = −3dB
where it is assumed that |H(Ω)| = 1 in the passband
Recall also the passband andstopband frequencies andripple definitions
(shown in the discrete domain)
IH(w)1
o
01 - Passband ripple02 - Stopband ripplew - Passband edge frequencypW s - Stopband edge frequency
: Stopband, f----------.:------ _:-4
Transition I... ..
band
K. E. Barner (Univ. of Delaware) ELEG–305: Digital Signal Processing Fall 2008 5 / 25
Design of IIR Filters from Analog Filters Butterworth Filters
Case 1: Butterworth Filters are all-pole, with the lowpass filter given by
|H(Ω)|2 =1
1 + (Ω/Ωc)2N =1
1 + ε2(Ω/Ωp)2N (∗)
⇒ Ωc is the cutoff frequency⇒ Ωp is the passband frequency⇒ 1− δ1 = 1/
√1 + ε2 is determined by the passband ripple
Recall that|H(Ω)|2 = H(s)H(−s)|s=jΩ
Using Ω = s/j substitution in (∗)
H(s)H(−s) =1
1 + ((s/j)/Ωc)2N
=1
1 + ((s/j)2/Ωc2)N
=1
1 + (−s2/Ωc2)N
K. E. Barner (Univ. of Delaware) ELEG–305: Digital Signal Processing Fall 2008 6 / 25
Design of IIR Filters from Analog Filters Butterworth Filters
H(s)H(−s) = 11+(−s2/Ωc
2)N has poles defined by
−s2
Ω2c
= (−1)1/N = ej(2k+1)π/N , k = 0,1, . . . ,N − 1
⇒ sk = Ωcejπ/2ej(2k+1)π/2N , k = 0,1, . . . ,N − 1
Observations: The poles of H(s)H(−s) are equally spaced around acircle of radius Ωc
Note: Poles of H(s) are inthe LHP and incomplex–conjugate pairs
(stable system with realvalued coefficients)
Poles ofH(s)
Poles ofH(s)
N=4
(a)
\
\\
\
\\
\
\\
\\
\\
N= 5
Poles ofH(-s)
Poles ofH(-s)
Butterworth pole positions (N = 5)
K. E. Barner (Univ. of Delaware) ELEG–305: Digital Signal Processing Fall 2008 7 / 25
Design of IIR Filters from Analog Filters Butterworth Filters
Consider the Butterworth filterresponse |H(Ω)|2
Observation: |H(Ω)| is monotonicin the pass and stop bands
Note: The required filter order Nmust still be determined
Set N to achieve the desiredstopband attenuation
|H(Ωs)|2 =1
1 + ε2(Ωs/Ωp)2N = δ22
IH(Q)12
1.1
1 1.01 + E2
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
o
Frequency response of Butterworth filtersRearranging gives
N =log[(1/δ2)− 1]
2 log(Ωs/Ωp)=
log(δ/ε)
log(Ωs/Ωp)
where we define δ =√
1/δ22 − 1
K. E. Barner (Univ. of Delaware) ELEG–305: Digital Signal Processing Fall 2008 8 / 25
Design of IIR Filters from Analog Filters Butterworth Filters
Butterworth Filter Summary
Note: A Butterworth filter is completely characterized by N, δ2, ε,Ωcand the ratio Ωs/Ωp
Set the filter order
N =log(δ/ε)
log(Ωs/Ωp), where δ =
√1/δ2
2 − 1
Determine the poles
sk = Ωcejπ/2ej(2k+1)π/2N , k = 0,1, . . . ,N − 1
Set the filter
H(s) =N−1∏k=0
1s − sk
Where H(s) is then mapped to H(z), e.g., through the bilineartransformation
K. E. Barner (Univ. of Delaware) ELEG–305: Digital Signal Processing Fall 2008 9 / 25
Design of IIR Filters from Analog Filters Butterworth Filters
ExampleDesign a digital Butterworth filter to achieve the following:
Passband Corner Frequency Fp = 15 kHz with ε = .2Cutoff Frequency Fc = 17 kHz
Stopband Corner Frequency Fs = 22 kHz with 40 dB of attenuationSampling Rate SR = 44kHz
Utilize the bilinear transformation s → z domain mapping
Fist normalize (convert) to digital frequencies
ωp = 2πFp/SR = 2.14ωc = 2πFc/SR = 2.43 and ωs = 2πFs/SR = 3.14
Next, warp the frequencies using Ω = 2T tan (ω/2); Final result is
indifferent to the T value; Set T = 1/SR
Ωp = 2SR tan (ωp/2) = 1644Ωc = 2SR tan (ωc/2) = 1866 and Ωs = 2SR tan (ωs/2) = 2413
K. E. Barner (Univ. of Delaware) ELEG–305: Digital Signal Processing Fall 2008 10 / 25
Design of IIR Filters from Analog Filters Butterworth Filters
Set the stopband ripple terms
10 log(δ22) = −40 dB
⇒ δ22 = 10−4, ⇒ δ =
√1δ2
2− 1 ≈ 100
The necessary filter order is
N =log(δ/ε)
log(Ωs/Ωp)=
log 100/.2log 2413/1644
=2.70
0.1667= 16.2⇒ N = 17
Determine the poles, map resulting transform to the digital domain
sk = Ωcejπ/2ej(2k+1)π/2N , k = 0,1, . . . ,16
⇒ H(s) =16∏
k=0
1(s − sk )
⇒ H(z) = H(s)|s=2SR
(1−z−1
1+z−1
)K. E. Barner (Univ. of Delaware) ELEG–305: Digital Signal Processing Fall 2008 11 / 25
Design of IIR Filters from Analog Filters Analog Filters Comparison
Analog Filter Characteristic Comparison
Note: Full specs for common analog filters are given in Chapter 10.3
Butterworth FiltersAll poleMonotonic frequency response in the pass and stop bands
Type I Chebyshev FiltersAll poleEquiripple passband frequency responseMonotonic stopband frequency response
Type II Chebyshev FiltersPole/ZeroMonotonic passband frequency responseEquiripple stopband frequency response
Elliptic FiltersPole/ZeroEquiripple pass/stop band frequency response
K. E. Barner (Univ. of Delaware) ELEG–305: Digital Signal Processing Fall 2008 12 / 25
Design of IIR Filters from Analog Filters Analog Filters Comparison
Chebyshev (Type I and II) & Elliptic Filter Comparison
IH(D.)j2
11 +€2
Type I Chebyshev Filter Type II Chebyshev Filter Elliptic Filter
Observations:Note the different pass/stop band characteristics (monotonic vs.equiripple)The elliptic filter has the sharpest transition region
K. E. Barner (Univ. of Delaware) ELEG–305: Digital Signal Processing Fall 2008 13 / 25
Frequency Translation Frequency Transformations in the Analog Domain
Observation: Polynomial expressions are given for lowpass filters only
Approach: Use frequency translation to obtain other filters
Example: The 2nd order Butterworth LP filter is
H(s) =1
s2 +√
2s + 1Note that for Ω = 1 or s = j (for frequency evaluation)
|H(s)|2 =1
| − 1 + j√
2 + 1|2=
12
⇒ Ωp = 1 (define passband edge frequency as the -3 dB frequency)
Question: How do we define a new LP filter with different cutoff freq.?
Solution: Perform the mapping
s →Ωp
Ω′ps
where Ωp and Ω′p are the old and new cutoff frequenciesK. E. Barner (Univ. of Delaware) ELEG–305: Digital Signal Processing Fall 2008 14 / 25
Frequency Translation Frequency Transformations in the Analog Domain
Thus utilizing s → ΩpΩ′p
s in the previous case (noting Ωp = 1)
H ′(s) =1(
ΩpΩ′p
s)2
+√
2(
ΩpΩ′p
s)
+ 1=
1(1
Ω′p
)2s2 +
√2
Ω′ps + 1
Analog Frequency Translation SummaryBand edge
Type of frequencies oftransformation Transformation new filter
Lowpass s → ΩpΩ′p
s Ω′p
Highpass s → ΩpΩ′ps Ω′p
Bandpass s → Ωps2+Ωl Ωus(Ωu−Ωl )
Ωl ,Ωu
Bandstop s → Ωps(Ωu−Ωl )s2+Ωl Ωu
Ωl ,Ωu
K. E. Barner (Univ. of Delaware) ELEG–305: Digital Signal Processing Fall 2008 15 / 25
Frequency Translation Filter Design Steps & Examples
Summary of Filter Design Steps
Approach: Given a set of design criteria (pass/stop band frequencies,attenuation and ripple parameters, etc.), perform the following steps
1 Determine order (N) from specs (ripple, attenuation, etc.)2 Look up the (lowpass) polynomial H(s) for that order3 Transform to desired filter type (high pass, band pass/stop, etc.)4 Map to the digital domain (H(s)→ H(z) by bilinear transformation
Note: Filter type transformation can also be performed in the discretedomain (see Table 10.8)
In that case, skid step #3 and perform the type transformation in thedigital domain after step #4
K. E. Barner (Univ. of Delaware) ELEG–305: Digital Signal Processing Fall 2008 16 / 25
Frequency Translation Filter Design Steps & Examples
ExampleDetermine a digital filter that meets or exceeds the following specs
Passband Frequency Fp = 4 kHz with passband ripple ≤ 1 dBStopband Frequency Fs = 6 kHz with ≥ 40 dB of attenuation
Sampling Rate SR = 24 kHz
Normalizing the frequency specifications to digital frequencies yields
ωp = 2πFp/SR = π/3 ωs = 2πFs/SR = π/2
Next, warp the frequencies using T = 2 for simplicity
Ωp = 2/T tan(ωp/2) = tan(π/6) = 0.509Ωs = tan(ωs/2) = tan(π/4) = 1
Next, utilize the given passband ripple (δ1) to determine ε
−(passband ripple) dB = 10 log(
11 + ε2
)K. E. Barner (Univ. of Delaware) ELEG–305: Digital Signal Processing Fall 2008 17 / 25
Frequency Translation Filter Design Steps & Examples
Thus
log(1 + ε2) =passband ripple
10= 0.1
⇒ ε =√
100.1 − 1 = 0.509
Now determine the other ripple parameters, δ2 and δ,
10 log(δ22) = −40 ⇒ δ2
2 = 10−4
⇒ δ =
√1δ2
2− 1 =
√104 − 1 = 99.995
Finally, determine the order necessary for different filter types
Case 1: Butterworth Filter order is given by
N ≥ log(δ/ε)
log(Ωs/Ωp)
=log(99.995/0.509)
log(1/0.509)
= 8.39⇒ N = 9K. E. Barner (Univ. of Delaware) ELEG–305: Digital Signal Processing Fall 2008 18 / 25
Frequency Translation Filter Design Steps & Examples
Case 2: Chebyshev Filter order is given by
N ≥ cosh−1(δ/ε)
cosh−1(Ωs/Ωp)
= 4.9⇒ N = 5
Case 3: Elliptic Filter requires complex integration, but yields N = 4
Observations:Required order decreases for Butterworth→ Chebyshev→ EllipticFilters that require smaller order allow passband/stopband ripple(or both); elliptic filters have the least linear phase response
Once order is found, there are two paths that can be taken:1 Use the exact polynomial and map to the discrete domain by the
bilinear transformation2 Look up low pass polynomial of correct order
- This is usually low pass with Ωc = 1- Use low→ low/band/high pass translation- Map to the discrete domain by the bilinear transformation
K. E. Barner (Univ. of Delaware) ELEG–305: Digital Signal Processing Fall 2008 19 / 25
IIR Filter Design Using Matlab
IIR Filter Design Using Matlab
Command: butter - design Butterworth IIR Filter
[B,A] = butter(N,Wn)
Gives N th order lowpass IIR Butterworth filter0 < Wn < 1 is the cutoff freq. (1 is half the sampling rate, or π)If Wn=[W1,W2], the order 2N bandpass filter is returned
[B,A] = butter(N,Wn,’high’)
Gives N th order highpass IIR Butterworth filter[B,A] = butter(N,Wn,’stop’)
Gives the order 2N band stop IIR Butterworth filter (Wn=[W1,W2])[z,p,k] = butter(N,Wn)
Gives the poles, zeros, and gain term, i.e.,
H(z) = k∏M
k=1(1− p(k)z−1)∏Nk=0(1− z(k)z−1)
K. E. Barner (Univ. of Delaware) ELEG–305: Digital Signal Processing Fall 2008 20 / 25
IIR Filter Design Using Matlab
Command: buttord - determines the necessary Butterworth filter order
[N,Wn] = buttord(Wp,Ws,Rp,Rs)
Inputs:Wp – passband frequencyWs – stopband frequencyRp – maximum passband loss (ripple)Rs – minimum stop band attenuationNote: Rp and Rs are in dB
Outputs:N – filter orderWn – filter cutoff (3 dB) frequency
Note: All frequencies are normalized (0<W<1). Also, order value isreturned for band pass/stop filters when vector frequencies are used(e.g., Wp=[W1,W2], etc.)
Usage: Determine (1) filter order (N) and cutoff frequency (Wn), then(2) filter parameters ([B,A]), i.e., apply buttord followed by butter
K. E. Barner (Univ. of Delaware) ELEG–305: Digital Signal Processing Fall 2008 21 / 25
IIR Filter Design Using Matlab
Chebyshev Type I Filters
Command: cheby1 - determines the Chebyshev Type I filter
[B, A] = cheby1(N, R, Wn)N – filter orderR – decibels of ripple in the passbandWn – cut-off frequency (3dB point)
Command: cheby1ord - determines the Chebyshev Type I filter order
[N, Wn] = cheb1ord(Wp, Ws, Rp, Rs)Wp – passband edge frequencyWs – stopband edge frequencyRp – decibels of loses allowed in the passbandRs – decibels of attenuation in the stopbandN – filter orderWn – cut off frequency
Note: Highpass and band pass/stop filters can be returned (same as inprevious case)
K. E. Barner (Univ. of Delaware) ELEG–305: Digital Signal Processing Fall 2008 22 / 25
IIR Filter Design Using Matlab
Chebyshev Type II Filters
Command: cheby2 - determines the Chebyshev Type II filter
[B, A] = cheby2(N, R, Wn)N – filter orderR – decibels of ripple in the stopbandWn – cutoff frequency (3dB point)
Command: cheby2ord - determines the Chebyshev Type II filter order
[N, Wn] = cheb2ord(Wp, Ws, Rp, Rs)Wp – passband edge frequencyWs – stopband edge frequencyRp – allowable passband ripple (dBs)Rs – minimum stopband attenuation (dBs)N – filter orderWn – cut off frequency
Note: Highpass and band pass/stop filters can be returned (same as inprevious case)
K. E. Barner (Univ. of Delaware) ELEG–305: Digital Signal Processing Fall 2008 23 / 25
IIR Filter Design Using Matlab
Elliptical Filters
Command: ellip - determines the elliptical filter
[B, A] = ellip(N, Rp, Rs, Wn)N – filter orderRp – passband ripple (dBs)Rs – stopband attenuation (dbs)Wn – cutoff frequency (3dB point)
Command: ellipord - determines the elliptical filter order
[N, Wn] = ellipord(Wp, Ws, Rp, Rs)Wp – passband edge frequencyWs – stopband edge frequencyRp – allowable passband ripple (dBs)Rs – minimum stopband attenuation (dBs)N – filter orderWn – cut off frequency
K. E. Barner (Univ. of Delaware) ELEG–305: Digital Signal Processing Fall 2008 24 / 25
Lecture Summary
Lecture SummaryAnalog Filter Families –Butterworth Filters: All pole; Monotonic frequency response in thepass and stop bandsChebyshev Type I Filters: All pole; Equiripple passband frequencyresponse; Monotonic stopband frequency responseChebyshev Type II Filters: Pole/Zero; Monotonic passbandfrequency response; Equiripple stopband frequency responseElliptic Filters: Pole/Zero; Equiripple pass/stop band responseFrequency Translation – Only lowpass filter expressions given;Use frequency translation to obtain highpass, band stop/passfilters; Performed in analog or digital domains (Tables 10.7 & 10.8)Filter Design – (1) Determine order (N); (2) Look up the (lowpass)polynomial H(s); (3) Transform to desired filter type; (4) Map tothe digital domain by bilinear transformationMatlab IIR Filter Design – butter, buttord; cheby1,cheb1ord; cheby2, cheb2ord; ellip, ellipord
K. E. Barner (Univ. of Delaware) ELEG–305: Digital Signal Processing Fall 2008 25 / 25