Вы находитесь на странице: 1из 10

Digital Filter Design Digital Filter Specifications

• Usually, either the magnitude and/or the


• Objective - Determination of a realizable
phase (delay) response is specified for the
transfer function G(z) approximating a
design of digital filter for most applications
given frequency response specification is an
important step in the development of a • In some situations, the unit sample response
digital filter or the step response may be specified
• If an IIR filter is desired, G(z) should be a • In most practical applications, the problem
stable real rational function of interest is the development of a realizable
approximation to a given magnitude
• Digital filter design is the process of
response specification
deriving the transfer function G(z)
Copyright © 2001, S. K. Mitra Copyright © 2001, S. K. Mitra

Digital Filter Specifications Digital Filter Specifications


• We discuss in this course only the • As the impulse response corresponding to
magnitude approximation problem each of these ideal filters is noncausal and
• There are four basic types of ideal filters of infinite length, these filters are not
with magnitude responses as shown below realizable
HLP(e j ) HHP (e j )
• In practice, the magnitude response
1 1
specifications of a digital filter in the
 – c 0 c 

 – c 0 c 
 passband and in the stopband are given with
HBP (e j ) HBS (e j ) some acceptable tolerances
–1 1 • In addition, a transition band is specified
 
between the passband and stopband
  – c2 – c1  c1  c2    – c2 – c1  c1  c2 
Copyright © 2001, S. K. Mitra Copyright © 2001, S. K. Mitra

Digital Filter Specifications Digital Filter Specifications


jω • As indicated in the figure, in the passband,
• For example, the magnitude response G (e )
of a digital lowpass filter may be given as defined by 0 ≤ ω ≤ ω p , we require that
indicated below G (e jω ) ≅ 1 with an error ± δ p , i.e.,
1 − δ p ≤ G (e jω ) ≤ 1 + δ p , ω ≤ ω p

• In the stopband, defined byω s ≤ ω ≤ π , we


require that G (e jω ) ≅ 0 with an error δ s ,
i.e.,
G (e jω ) ≤ δ s , ω s ≤ ω ≤ π

Copyright © 2001, S. K. Mitra Copyright © 2001, S. K. Mitra

1
Digital Filter Specifications
Digital Filter Specifications
• ω p - passband edge frequency
• ω s - stopband edge frequency • Specifications are often given in terms of
• δ p - peak ripple value in the passband loss function G (ω ) = − 20 log10 G (e jω ) in dB
• δ s - peak ripple value in the stopband • Peak passband ripple
• Since G (e jω ) is a periodic function of ω, α p = − 20 log10 (1 − δ p ) dB
and G (e jω ) of a real-coefficient digital • Minimum stopband attenuation
filter is an even function of ω α s = − 20 log10 (δ s ) dB
• As a result, filter specifications are given
only for the frequency range 0 ≤ ω ≤ π
Copyright © 2001, S. K. Mitra Copyright © 2001, S. K. Mitra

Digital Filter Specifications Digital Filter Specifications


• Magnitude specifications may alternately be
• Here, the maximum value of the magnitude
given in a normalized form as indicated
in the passband is assumed to be unity
below

• 1 / 1 + ε 2 - Maximum passband deviation,


given by the minimum value of the
magnitude in the passband

• 1 - Maximum stopband magnitude


A

Copyright © 2001, S. K. Mitra Copyright © 2001, S. K. Mitra

Digital Filter Specifications


Digital Filter Specifications • In practice, passband edge frequency Fp
and stopband edge frequency Fs are
• For the normalized specification, maximum specified in Hz
value of the gain function or the minimum • For digital filter design, normalized
value of the loss function is 0 dB bandedge frequencies need to be computed
• Maximum passband attenuation - from specifications in Hz using
( )
α max = 20 log10 1 + ε 2 dB Ω
ωp = p =
2π Fp
= 2π FpT
• For δ p << 1, it can be shown that FT FT
α max ≅ − 20 log10 (1 − 2 δ p ) dB Ω 2π Fs
ωs = s = = 2π Fs T
FT FT
Copyright © 2001, S. K. Mitra Copyright © 2001, S. K. Mitra

2
Selection of Filter Type
Digital Filter Specifications • The transfer function H(z) meeting the
frequency response specifications should be
• Example - Let Fp = 7 kHz, Fs = 3 kHz, and a causal transfer function
FT = 25 kHz • For IIR digital filter design, the IIR transfer
• Then function is a real rational function of z −1:
2π (7 × 103 )
ωp = = 0.56π p0 + p1 z −1 + p2 z −2 + L + pM z − M
25 × 103 H ( z) =
d 0 + d1z −1 + d 2 z −2 + L + d N z − N
2π (3 × 103 )
ωs = = 0.24π • H(z) must be a stable transfer function and
25 × 103 must be of lowest order N for reduced
computational complexity
Copyright © 2001, S. K. Mitra Copyright © 2001, S. K. Mitra

Selection of Filter Type Selection of Filter Type


• For FIR digital filter design, the FIR • Advantages in using an FIR filter -
transfer function is a polynomial in z −1
with real coefficients: (1) Can be designed with exact linear phase,
N (2) Filter structure always stable with
H ( z ) = å h[ n] z − n quantized coefficients
n=0
• Disadvantages in using an FIR filter - Order
• For reduced computational complexity,
of an FIR filter, in most cases, is
degree N of H(z) must be as small as
possible considerably higher than the order of an
equivalent IIR filter meeting the same
• If a linear phase is desired, the filter
coefficients must satisfy the constraint: specifications, and FIR filter has thus higher
computational complexity
h[ n] = ± h[ N − n]
Copyright © 2001, S. K. Mitra Copyright © 2001, S. K. Mitra

Digital Filter Design:


Digital Filter Design:
Basic Approaches
Basic Approaches • This approach has been widely used for the
• Most common approach to IIR filter design - following reasons:
(1) Convert the digital filter specifications (1) Analog approximation techniques are
into an analog prototype lowpass filter highly advanced
specifications (2) They usually yield closed-form
• (2) Determine the analog lowpass filter solutions
transfer function H a (s) (3) Extensive tables are available for
analog filter design
• (3) Transform H a (s ) into the desired digital
(4) Many applications require digital
transfer function G (z )
simulation of analog systems
Copyright © 2001, S. K. Mitra Copyright © 2001, S. K. Mitra

3
Digital Filter Design: Digital Filter Design:
Basic Approaches Basic Approaches
• An analog transfer function to be denoted as • Basic idea behind the conversion of H a (s )
into G ( z ) is to apply a mapping from the
P (s)
H a (s) = a s-domain to the z-domain so that essential
Da ( s ) properties of the analog frequency response
where the subscript “a” specifically are preserved
indicates the analog domain • Thus mapping function should be such that
• A digital transfer function derived from H a (s ) – Imaginary ( jΩ ) axis in the s-plane be
shall be denoted as mapped onto the unit circle of the z-plane
P( z )
G( z) = – A stable analog transfer function be mapped
D( z ) into a stable digital transfer function
Copyright © 2001, S. K. Mitra Copyright © 2001, S. K. Mitra

Digital Filter Design:


Digital Filter Design:
Basic Approaches
• FIR filter design is based on a direct
Basic Approaches
approximation of the specified magnitude • Three commonly used approaches to FIR
response, with the often added requirement filter design -
that the phase be linear
(1) Windowed Fourier series approach
• The design of an FIR filter of order N may
be accomplished by finding either the (2) Frequency sampling approach
length-(N+1) impulse response samples {h[n]} (3) Computer-based optimization methods
or the (N+1) samples of its frequency
response H (e jω )
Copyright © 2001, S. K. Mitra Copyright © 2001, S. K. Mitra

IIR Digital Filter Design: Bilinear


Bilinear Transformation
Transformation Method
• Bilinear transformation - • Digital filter design consists of 3 steps:
æ −1 ö (1) Develop the specifications of Ha (s ) by
s = 2 çç 1 − z −1 ÷÷ applying the inverse bilinear transformation
T è1 + z ø
to specifications of G(z)
• Above transformation maps a single point
in the s-plane to a unique point in the (2) Design Ha (s )
z-plane and vice-versa (3) Determine G(z) by applying bilinear
• Relation between G(z) and Ha (s ) is then transformation to Ha ( s )
given by • As a result, the parameter T has no effect on
G ( z ) = Ha ( s ) 2 æç 1− z −1 ö÷ G(z) and T = 2 is chosen for convenience
s=
T ç 1+ z −1 ÷
è ø
Copyright © 2001, S. K. Mitra Copyright © 2001, S. K. Mitra

4
Bilinear Transformation
• Inverse bilinear transformation for T = 2 is Bilinear Transformation
z = 1+ s
1− s • Mapping of s-plane into the z-plane

• For s = σo + jΩo
(1 + σ o ) + jΩ o 2 (1 + σ o ) 2 + Ωo2
z= Þz =
(1 − σ o ) − jΩo (1 − σ o ) 2 + Ω 2o
• Thus, σo = 0 → z =1
σo < 0 → z <1
σo > 0 → z >1
Copyright © 2001, S. K. Mitra Copyright © 2001, S. K. Mitra

Bilinear Transformation Bilinear Transformation



• For z = e with T = 2 we have • Mapping is highly nonlinear
− jω
jΩ = 1 − e − jω = j tan(ω / 2) • Complete negative imaginary axis in the s-
1+ e plane from Ω = −∞ to Ω = 0 is mapped into
or Ω = tan(ω / 2) the lower half of the unit circle in the z-plane
from z = −1 to z = 1
• Complete positive imaginary axis in the s-
plane from Ω = 0 to Ω = ∞ is mapped into the
upper half of the unit circle in the z-plane
from z = 1 to z = −1

Copyright © 2001, S. K. Mitra Copyright © 2001, S. K. Mitra

Bilinear Transformation Bilinear Transformation


• Nonlinear mapping introduces a distortion • Steps in the design of a digital filter -
in the frequency axis called frequency (1) Prewarp (ω p , ω s ) to find their analog
warping equivalents (Ω p , Ω s )
• Effect of warping shown below (2) Design the analog filter H a (s )
(3) Design the digital filter G(z) by applying
bilinear transformation to H a (s )
• Transformation can be used only to design
digital filters with prescribed magnitude
response with piecewise constant values
• Transformation does not preserve phase
response of analog filter
Copyright © 2001, S. K. Mitra Copyright © 2001, S. K. Mitra

5
IIR Digital Filter Design Using
Bilinear Transformation IIR Digital Filter Design Using
• Example - Consider Bilinear Transformation
Ωc • Rearranging terms we get
H a (s) =
s + Ωc −1
G ( z ) = 1 − α ⋅ 1 + z −1
• Applying bilinear transformation to the above 2 1−α z
we get the transfer function of a first-order where
digital lowpass Butterworth filter
1 − Ωc 1 − tan( ωc / 2)
α= =
Ωc (1 + z −1 ) 1 + Ωc 1 + tan(ωc / 2)
G ( z ) = H a ( s ) s =1− z −1 =
1+ z −1
(1 − z −1 ) + Ω c (1 + z −1 )

Copyright © 2001, S. K. Mitra Copyright © 2001, S. K. Mitra

IIR Digital Filter Design Using IIR Digital Filter Design Using
Bilinear Transformation Bilinear Transformation
• Example - Consider the second-order analog • Then G ( z ) = H a ( s) s =1− z −1

notch transfer function 1+ z −1

s 2 + Ω o2 (1 + Ωo ) − 2(1 − Ωo ) z −1 + (1 + Ωo2 ) z − 2
2 2
H a ( s) = 2 =
s + B s + Ωo2 (1 + Ωo2 + B ) − 2(1 − Ωo2 ) z −1 + (1 + Ωo2 − B) z −2
−1 −2
for which H a ( jΩo ) = 0 1+ α 1 − 2β z + z
= ⋅
2 1 − 2 β (1 + α ) z −1 + α z −2
H a ( j 0) = H a ( j∞) = 1
• Ωo is called the notch frequency 1 + Ωo2 − B 1 − tan( Bw / 2)
where α = =
• If H a ( jΩ 2 ) = H a ( jΩ1 ) = 1 / 2 then 1 + Ω o2 + B 1 + tan( Bw / 2)
B = Ω 2 − Ω1 is the 3-dB notch bandwidth 1 − Ωo2
β= = cos ω o
Copyright © 2001, S. K. Mitra 1 + Ωo2 Copyright © 2001, S. K. Mitra

IIR Digital Filter Design Using IIR Digital Filter Design Using
Bilinear Transformation Bilinear Transformation
• Example - Design a 2nd-order digital notch • Thus
filter operating at a sampling rate of 400 Hz 0.954965 − 1.1226287 z −1 + 0.954965 z −2
with a notch frequency at 60 Hz, 3-dB notch G ( z) =
bandwidth of 6 Hz 1 − 1.1226287 z −1 + 0.90993 z −2
• The gain and phase responses are shown below
• Thus ω o = 2π (60 / 400) = 0.3π 2

Bw = 2π (6 / 400) = 0.03π 0
1
Phase, radians

-10
• From the above values we get
Gain, dB

0
-20
α = 0.90993 -30 -1

β = 0.587785 -40
0 50 100 150 200
-2
0 50 100 150 200
Frequency, Hz Frequency, Hz
Copyright © 2001, S. K. Mitra Copyright © 2001, S. K. Mitra

6
IIR Lowpass Digital Filter Design IIR Lowpass Digital Filter Design
Using Bilinear Transformation Using Bilinear Transformation
• Example - Design a lowpass Butterworth • Prewarping we get
digital filter with ω p = 0.25π , ω s = 0.55π , Ω p = tan(ω p / 2) = tan(0.25π / 2) = 0.4142136
α p ≤ 0.5 dB, and α s ≥ 15 dB Ω s = tan(ω s / 2) = tan(0.55π / 2) = 1.1708496
• Thus • The inverse transition ratio is
ε 2 = 0.1220185 A2 = 31.622777 1 Ωs
= = 2.8266809
• If G (e j 0 ) = 1 this implies k Ωp
20 log10 G (e j 0.25π ) ≥ − 0.5 • The inverse discrimination ratio is
1 A2 − 1
20 log10 G (e j 0.55π ) ≤ −15 = = 15.841979
k1 ε
Copyright © 2001, S. K. Mitra Copyright © 2001, S. K. Mitra

IIR Lowpass Digital Filter Design IIR Lowpass Digital Filter Design
Using Bilinear Transformation Using Bilinear Transformation
• We then get
log10 (1 / k1 ) Ω c = 1.419915 (Ω p ) = 0.588148
• Thus N= = 2.6586997
log10 (1 / k )
• 3rd-order lowpass Butterworth transfer
• We choose N = 3 function for Ω c = 1 is
• To determine Ω c we use 1
Han ( s ) =
( s + 1)( s 2 + s + 1)
2 1 1
H a ( jΩ p ) = = • Denormalizing to get Ω c = 0.588148 we
1 + (Ω p / Ω c ) 2 N 1 + ε 2
arrive at s
Ha ( s ) = Han æç ö
÷
è 0. 588148 ø
Copyright © 2001, S. K. Mitra Copyright © 2001, S. K. Mitra

IIR Lowpass Digital Filter Design Design of IIR Highpass,


Highpass, Bandpass,
Bandpass,
Using Bilinear Transformation and Bandstop Digital Filters
• Applying bilinear transformation to H a (s) • First Approach -
we get the desired digital transfer function
(1) Prewarp digital frequency specifications
G ( z ) = H a ( s) s =1− z −1

1+ z −1 of desired digital filter GD (z ) to arrive at


• Magnitude and gain responses of G(z) shown frequency specifications of analog filter H D (s )
below: of same type
1 0

0.8 -10
(2) Convert frequency specifications of H D (s )
into that of prototype analog lowpass filter
Magnitude

Gain, dB

0.6
-20
0.4 H LP (s )
-30
0.2

0 -40
(3) Design analog lowpass filter H LP (s )
0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1
ω/π ω/π
Copyright © 2001, S. K. Mitra Copyright © 2001, S. K. Mitra

7
Design of IIR Highpass,
Highpass, Bandpass,
Bandpass, Design of IIR Highpass,
Highpass, Bandpass,
Bandpass,
and Bandstop Digital Filters and Bandstop Digital Filters
(4) Convert H LP (s ) into H D (s ) using • Second Approach -
inverse frequency transformation used in (1) Prewarp digital frequency specifications
Step 2 of desired digital filter GD (z ) to arrive at
(5) Design desired digital filter GD ( z ) by frequency specifications of analog filter H D ( s )
applying bilinear transformation to H LP ( s ) of same type
(2) Convert frequency specifications of H D ( s )
into that of prototype analog lowpass filter
H LP (s )
Copyright © 2001, S. K. Mitra Copyright © 2001, S. K. Mitra

Design of IIR Highpass,


Highpass, Bandpass,
Bandpass, IIR Highpass Digital Filter Design
and Bandstop Digital Filters • Design of a Type 1 Chebyshev IIR digital
highpass filter
(3) Design analog lowpass filter H LP (s ) • Specifications: Fp = 700 Hz, Fs = 500 Hz,
(4) Convert H LP (s ) into an IIR digital α p = 1 dB, α s = 32 dB, FT = 2 kHz
transfer function GLP (z ) using bilinear
• Normalized angular bandedge frequencies
transformation
(5) Transform GLP (z ) into the desired 2π Fp
2π × 700
ωp = = = 0.7π
digital transfer function GD (z ) FT 2000
• We illustrate the first approach 2π Fs 2π × 500
ωs = = = 0.5π
FT 2000
Copyright © 2001, S. K. Mitra Copyright © 2001, S. K. Mitra

IIR Highpass Digital Filter Design IIR Highpass Digital Filter Design
• Prewarping these frequencies we get • MATLAB code fragments used for the design
ˆ p = tan(ω p / 2) = 1.9626105
Ω [N, Wn] = cheb1ord(1, 1.9626105, 1, 32, ’s’)
Ωˆ s = tan(ω s / 2) = 1.0 [B, A] = cheby1(N, 1, Wn, ’s’);
• For the prototype analog lowpass filter choose [BT, AT] = lp2hp(B, A, 1.9626105);
Ωp =1 [num, den] = bilinear(BT, AT, 0.5);
Ω Ω ˆ
• Using Ω = − p p we get Ω s = 1.962105 0

Ωˆ -10

• Analog lowpass filter specifications: Ω p = 1 ,


Gain, dB

-20
-30
Ω s = 1.926105 , α p = 1 dB, α s = 32 dB -40

-50
0 0.2 0.4 0.6 0.8 1
ω/π
Copyright © 2001, S. K. Mitra Copyright © 2001, S. K. Mitra

8
IIR Bandpass Digital Filter Design IIR Bandpass Digital Filter Design
• Design of a Butterworth IIR digital bandpass • Width of passband Bw = Ω ˆ p2 − Ωˆ p1 = 0.777771
filter
ˆ o2 = Ω
Ω ˆ p1Ωˆ p 2 = 1.393733
• Specifications: ω p1 = 0.45π , ω p 2 = 0.65π ,
ˆ s1Ω
Ω ˆ s 2 = 1.23010325 ≠ Ω ˆ o2
ω s1 = 0.3π , ω s 2 = 0.75π , α p = 1 dB, α s = 40 dB ˆ s1and
• We therefore modify Ω s1 so that Ω
ˆ
• Prewarping we get Ωˆ s 2 exhibit geometric symmetry with
ˆ p1 = tan(ω p1 / 2) = 0.8540807
Ω respect to Ω ˆ o2
ˆ p 2 = tan(ω p 2 / 2) = 1.6318517
Ω • We set Ω ˆ s1 = 0.5773031
Ωˆ s1 = tan(ω s1 / 2) = 0.5095254 • For the prototype analog lowpass filter we
ˆ choose Ω p = 1
Ω s 2 = tan(ω s 2 / 2) = 2.41421356
Copyright © 2001, S. K. Mitra Copyright © 2001, S. K. Mitra

IIR Bandpass Digital Filter Design IIR Bandpass Digital Filter Design
ˆ2 ˆ2 • MATLAB code fragments used for the design
• Using Ω = −Ω p Ωo − Ω we get [N, Wn] = buttord(1, 2.3617627, 1, 40, ’s’)
ˆ Bw

[B, A] = butter(N, Wn, ’s’);
1.393733 − 0.3332788 [BT, AT] = lp2bp(B, A, 1.1805647, 0.777771);
Ωs = = 2.3617627
0.5773031× 0.777771 [num, den] = bilinear(BT, AT, 0.5);
• Specifications of prototype analog 0

Butterworth lowpass filter: -10


Gain, dB

Ω p = 1 , Ω s = 2.3617627 , α p = 1 dB,
-20
-30

α s = 40 dB -40
-50
0 0.2 0.4 0.6 0.8 1
ω/π
Copyright © 2001, S. K. Mitra Copyright © 2001, S. K. Mitra

IIR Bandstop Digital Filter Design IIR Bandstop Digital Filter Design
• Design of an elliptic IIR digital bandstop filter • We therefore modify Ω ˆ p1and Ω
ˆ p1so that Ω ˆ p2
• Specifications: ω s1 = 0.45π , ω s 2 = 0.65π , exhibit geometric symmetry with respect to
ω p1 = 0.3π, ω p 2 = 0.75π , α p = 1 dB, α s = 40 dB Ωˆ o2
• Prewarping we get • We set Ω ˆ p1 = 0.577303
Ωˆ s1 = 0.8540806, Ω ˆ s 2 = 1.6318517, • For the prototype analog lowpass filter we
ˆ p1 = 0.5095254, Ω
Ω ˆ p 2 = 2.4142136 choose Ω s = 1
ΩˆB
• Width of stopband Bw = Ω ˆ s2 − Ωˆ s1 = 0.777771 • Using Ω = Ω s 2 w 2 we get
ˆ o −Ω
Ω ˆ
Ωˆ o2 = Ωˆ s 2Ω
ˆ s1 = 1.393733 0.5095254 × 0.777771
ˆ p 2Ω ˆ p1 = 1.230103 ≠ Ω ˆ o2 Ωp = = 0.4234126
Ω 1.393733 − 0.3332787
Copyright © 2001, S. K. Mitra Copyright © 2001, S. K. Mitra

9
IIR Bandstop Digital Filter Design
• MATLAB code fragments used for the design
[N, Wn] = ellipord(0.4234126, 1, 1, 40, ’s’);
[B, A] = ellip(N, 1, 40, Wn, ’s’);
[BT, AT] = lp2bs(B, A, 1.1805647, 0.777771);
[num, den] = bilinear(BT, AT, 0.5);
0
-10
Gain, dB

-20
-30
-40

-50
0 0.2 0.4 0.6 0.8 1
ω/π
Copyright © 2001, S. K. Mitra

10

Вам также может понравиться