ch9(1)handouts_3e
DESCRIPTION
jnTRANSCRIPT
-
11Copyright 2005, S. K. Mitra
Digital Filter DesignDigital Filter Design
Objective - Determination of a realizable transfer function G(z) approximating a given frequency response specification is an important step in the development of a digital filter
If an IIR filter is desired, G(z) should be a stable real rational function
Digital filter design is the process of deriving the transfer function G(z)
2Copyright 2005, S. K. Mitra
Digital Filter SpecificationsDigital Filter Specifications Usually, either the magnitude and/or the
phase (delay) response is specified for the design of digital filter for most applications
In some situations, the unit sample responseor the step response may be specified
In most practical applications, the problem of interest is the development of a realizable approximation to a given magnitude response specification
3Copyright 2005, S. K. Mitra
Digital Filter SpecificationsDigital Filter Specifications We discuss in this course only the
magnitude approximation problem There are four basic types of ideal filters
with magnitude responses as shown below
1
0 c c
HLP(e j )
0 c c
1
HHP(e j )
11
c1 c1 c2 c2
HBP (e j )
1
c1 c1 c2 c2
HBS(e j )
4Copyright 2005, S. K. Mitra
Digital Filter SpecificationsDigital Filter Specifications As the impulse response corresponding to
each of these ideal filters is noncausal and of infinite length, these filters are not realizable
In practice, the magnitude response specifications of a digital filter in the passband and in the stopband are given with some acceptable tolerances
In addition, a transition band is specified between the passband and stopband
5Copyright 2005, S. K. Mitra
Digital Filter SpecificationsDigital Filter Specifications For example, the magnitude response
of a digital lowpass filter may be given as indicated below
)( jeG
6Copyright 2005, S. K. Mitra
Digital Filter SpecificationsDigital Filter Specifications As indicated in the figure, in the passband,
defined by , we require that with an error , i.e.,
In the stopband, defined by , we require that with an error , i.e.,
1)( jeG
0)( jeG s
pp0
spp
jp eG + ,1)(1
ssjeG ,)(
-
27Copyright 2005, S. K. Mitra
Digital Filter SpecificationsDigital Filter Specifications - passband edge frequency - stopband edge frequency - peak ripple value in the passband - peak ripple value in the stopband Since is a periodic function of ,
and of a real-coefficient digital filter is an even function of
As a result, filter specifications are given only for the frequency range
ps
sp
)( jeG)( jeG
08
Copyright 2005, S. K. Mitra
Digital Filter SpecificationsDigital Filter Specifications
Specifications are often given in terms of loss function A in dB
Peak passband rippledB
Minimum stopband attenuationdB
)(log20)( 10= jeG
)1(log20 10 pp =
)(log20 10 ss =
9Copyright 2005, S. K. Mitra
Digital Filter SpecificationsDigital Filter Specifications Magnitude specifications may alternately be
given in a normalized form as indicated below
10Copyright 2005, S. K. Mitra
Digital Filter SpecificationsDigital Filter Specifications Here, the maximum value of the magnitude
in the passband is assumed to be unity
- Maximum passband deviation, given by the minimum value of the magnitude in the passband
- Maximum stopband magnitudeA1
21/1 +
11Copyright 2005, S. K. Mitra
Digital Filter SpecificationsDigital Filter Specifications
For the normalized specification, maximum value of the gain function or the minimum value of the loss function is 0 dB
Maximum passband attenuation -dB
For , it can be shown thatdB
( )210max 1log20 +=1
-
313Copyright 2005, S. K. Mitra
Digital Filter SpecificationsDigital Filter Specifications
Example - Let kHz, kHz, and kHz
Then
7=pF 3=sF25=TF
== 56.01025
)107(23
3
p
== 24.01025
)103(23
3
s
14Copyright 2005, S. K. Mitra
The transfer function H(z) meeting the frequency response specifications should be a causal transfer function
For IIR digital filter design, the IIR transfer function is a real rational function of :
H(z) must be a stable transfer function and must be of lowest order N for reduced computational complexity
Selection of Filter TypeSelection of Filter Type
1z
NMzdzdzddzpzpzppzH N
N
MM ++++
++++=
,)( 22
110
22
110
LL
15Copyright 2005, S. K. Mitra
Selection of Filter TypeSelection of Filter Type For FIR digital filter design, the FIR
transfer function is a polynomial in with real coefficients:
For reduced computational complexity, degree N of H(z) must be as small as possible
If a linear phase is desired, the filter coefficients must satisfy the constraint:
==
N
n
nznhzH0
][)(
][][ nNhnh =
1z
16Copyright 2005, S. K. Mitra
Selection of Filter TypeSelection of Filter Type Advantages in using an FIR filter -
(1) Can be designed with exact linear phase,(2) Filter structure always stable with quantized coefficients
Disadvantages in using an FIR filter - Order of an FIR filter, in most cases, is considerably higher than the order of an equivalent IIR filter meeting the same specifications, and FIR filter has thus higher computational complexity
17Copyright 2005, S. K. Mitra
Digital Filter Design: Digital Filter Design: Basic ApproachesBasic Approaches
Most common approach to IIR filter design -(1) Convert the digital filter specifications into an analog prototype lowpass filter specifications
(2) Determine the analog lowpass filter transfer function
(3) Transform into the desired digital transfer function
)(sHa
)(zG)(sHa
18Copyright 2005, S. K. Mitra
Digital Filter Design: Digital Filter Design: Basic ApproachesBasic Approaches
This approach has been widely used for the following reasons:(1) Analog approximation techniques are highly advanced(2) They usually yield closed-form solutions(3) Extensive tables are available for analog filter design(4) Many applications require digital simulation of analog systems
-
419Copyright 2005, S. K. Mitra
Digital Filter Design: Digital Filter Design: Basic ApproachesBasic Approaches
An analog transfer function to be denoted as
where the subscript a specifically indicates the analog domain
A digital transfer function derived from shall be denoted as
)()()( sDsPsH
a
aa =
)()()( zDzPzG =
)(sHa
20Copyright 2005, S. K. Mitra
Digital Filter Design: Digital Filter Design: Basic ApproachesBasic Approaches
Basic idea behind the conversion of into is to apply a mapping from the s-domain to the z-domain so that essential properties of the analog frequency response are preserved
Thus mapping function should be such that Imaginary ( ) axis in the s-plane be
mapped onto the unit circle of the z-plane A stable analog transfer function be mapped
into a stable digital transfer function
)(sHa)(zG
j
21Copyright 2005, S. K. Mitra
Digital Filter Design: Digital Filter Design: Basic ApproachesBasic Approaches
FIR filter design is based on a direct approximation of the specified magnitude response, with the often added requirement that the phase be linear
The design of an FIR filter of order N may be accomplished by finding either the length-(N+1) impulse response samplesor the (N+1) samples of its frequency response
{ }][nh)( jeH
22Copyright 2005, S. K. Mitra
Digital Filter Design: Digital Filter Design: Basic ApproachesBasic Approaches
Three commonly used approaches to FIR filter design -(1) Windowed Fourier series approach(2) Frequency sampling approach(3) Computer-based optimization methods
23Copyright 2005, S. K. Mitra
IIR Digital Filter Design: Bilinear IIR Digital Filter Design: Bilinear Transformation MethodTransformation Method
Bilinear transformation -
Above transformation maps a single point in the s-plane to a unique point in the z-plane and vice-versa
Relation between G(z) and is then given by
+=
1
1
112
zz
Ts
)(sHa
+== 11112)()(
z
zTs
a sHzG24
Copyright 2005, S. K. Mitra
Bilinear TransformationBilinear Transformation Digital filter design consists of 3 steps:
(1) Develop the specifications of by applying the inverse bilinear transformation to specifications of G(z)(2) Design(3) Determine G(z) by applying bilinear transformation to
As a result, the parameter T has no effect on G(z) and T = 2 is chosen for convenience
)(sHa
)(sHa
)(sHa
-
525Copyright 2005, S. K. Mitra
Bilinear TransformationBilinear Transformation Inverse bilinear transformation for T = 2 is
For
Thus,
ssz
+= 11
oo js +=22
222
)1()1(
)1()1(
oo
oo
oo
oo zjjz +
++=++=
10 == zo10 zo 26
Copyright 2005, S. K. Mitra
Bilinear TransformationBilinear Transformation
Mapping of s-plane into the z-plane
27Copyright 2005, S. K. Mitra
Bilinear TransformationBilinear Transformation For with T = 2 we have
or
)()(
11
2/2/2/
2/2/2/
+=+
= jjjjjj
j
j
eeeeee
eej
= jez
)2/tan(=)2/tan(
)2/cos(2)2/sin(2 =
= jj
28Copyright 2005, S. K. Mitra
Bilinear TransformationBilinear Transformation Mapping is highly nonlinear Complete negative imaginary axis in the s-
plane from to is mapped into the lower half of the unit circle in the z-plane from to
Complete positive imaginary axis in the s-plane from to is mapped into the upper half of the unit circle in the z-plane from to
= 0=
0= =
1=z 1=z
1=z 1=z
29Copyright 2005, S. K. Mitra
Bilinear TransformationBilinear Transformation Nonlinear mapping introduces a distortion
in the frequency axis called frequency warping
Effect of warping shown below = tan(/2)
30Copyright 2005, S. K. Mitra
Bilinear TransformationBilinear Transformation Steps in the design of a digital filter -
(1) Prewarp to find their analog equivalents(2) Design the analog filter(3) Design the digital filter G(z) by applying bilinear transformation to
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
),( sp ),( sp
)(sHa
)(sHa
-
631Copyright 2005, S. K. Mitra
IIR Digital Filter Design Using IIR Digital Filter Design Using Bilinear TransformationBilinear Transformation
Example - Consider
Applying bilinear transformation to the above we get the transfer function of a first-order digital lowpass Butterworth filter
c
ca ssH +
=)(
)1()1()1()()( 11
1
11
11
+= ++
+==zz
zsHzGc
c
zzsa
32Copyright 2005, S. K. Mitra
IIR Digital Filter Design Using IIR Digital Filter Design Using Bilinear TransformationBilinear Transformation
Rearranging terms we get
where
1
1
11
21)(
+=
zzzG
)2/tan(1)2/tan(1
11
c
c
c
c+=+
=
33Copyright 2005, S. K. Mitra
IIR Digital Filter Design Using IIR Digital Filter Design Using Bilinear TransformationBilinear Transformation
Example - Consider the second-order analog notch transfer function
for which
is called the notch frequency If then
is the 3-dB notch bandwidth
22
22)(
o
oa sBs
ssH +++=0)( =oa jH
1)()0( == jHjH aao
2/1)()( 12 == jHjH aa12 =B
34Copyright 2005, S. K. Mitra
IIR Digital Filter Design Using IIR Digital Filter Design Using Bilinear TransformationBilinear Transformation
Then
where
1
1
11)()(
+==zzsa
sHzG
22122
22122
)1()1(2)1()1()1(2)1(
+++++++=
zBzBzz
ooo
ooo
21
21
)1(2121
21
++++=
zzzz
oo
o =+= cos
11
2
2)2/tan(1)2/tan(1
11
2
2
w
w
o
oBB
BB
+=++
+=
35Copyright 2005, S. K. Mitra
IIR Digital Filter Design Using IIR Digital Filter Design Using Bilinear TransformationBilinear Transformation
Example - Design a 2nd-order digital notch filter operating at a sampling rate of 400 Hzwith a notch frequency at 60 Hz, 3-dB notch bandwidth of 6 Hz
Thus
From the above values we get
== 3.0)400/60(2o== 03.0)400/6(2wB
90993.0=587785.0=
36Copyright 2005, S. K. Mitra
IIR Digital Filter Design Using IIR Digital Filter Design Using Bilinear TransformationBilinear Transformation
Thus
The gain and phase responses are shown below
21
21
90993.01226287.11954965.01226287.1954965.0)(
+
+=zz
zzzG
0 50 100 150 200-40
-30
-20
-10
0
Frequency, Hz
Gain
, dB
0 50 100 150 200-2
-1
0
1
2
Frequency, Hz
Phas
e, ra
dian
s
-
737Copyright 2005, S. K. Mitra
IIR IIR LowpassLowpass Digital Filter Design Digital Filter Design Using Bilinear TransformationUsing Bilinear Transformation
Example - Design a lowpass Butterworth digital filter with , ,
dB, and dB Thus
If this implies
= 25.0p = 55.0s15s5.0 p
5.0)(log20 25.010 jeG15)(log20 55.010 jeG
1)( 0 =jeG1220185.02 = 622777.312 =A
38Copyright 2005, S. K. Mitra
IIR IIR LowpassLowpass Digital Filter Design Digital Filter Design Using Bilinear TransformationUsing Bilinear Transformation
Prewarping we get
The inverse transition ratio is
The inverse discrimination ratio is
4142136.0)2/25.0tan()2/tan( === pp1708496.1)2/55.0tan()2/tan( === ss
8266809.21 ==
p
sk
841979.15112
1=
= Ak
39Copyright 2005, S. K. Mitra
IIR IIR LowpassLowpass Digital Filter Design Digital Filter Design Using Bilinear TransformationUsing Bilinear Transformation
Thus
We choose N = 3 To determine we use
6586997.2)/1(log)/1(log
10
110 ==kkN
c
222
11
)/(11)( +=+= Ncppa
jH
40Copyright 2005, S. K. Mitra
IIR IIR LowpassLowpass Digital Filter Design Digital Filter Design Using Bilinear TransformationUsing Bilinear Transformation
We then get
3rd-order lowpass Butterworth transfer function for is
Denormalizing to get we arrive at
588148.0)(419915.1 == pc
1=c)1)(1(
1)( 2 +++= ssssHan
=588148.0
)( sHsH ana
588148.0=c
41Copyright 2005, S. K. Mitra
IIR IIR LowpassLowpass Digital Filter Design Digital Filter Design Using Bilinear TransformationUsing Bilinear Transformation
Applying bilinear transformation to we get the desired digital transfer function
Magnitude and gain responses of G(z) shown below:
)(sHa
1
1
11)()(
+==zzsa sHzG
0 0.2 0.4 0.6 0.8 10
0.2
0.4
0.6
0.8
1
/
Mag
nitu
de
0 0.2 0.4 0.6 0.8 1-40
-30
-20
-10
0
/
Gain
, dB
42Copyright 2005, S. K. Mitra
Design of IIR Design of IIR HighpassHighpass, , BandpassBandpass, , and and BandstopBandstop Digital FiltersDigital Filters
First Approach -(1) Prewarp digital frequency specifications of desired digital filter to arrive at frequency specifications of analog filter of same type(2) Convert frequency specifications of into that of prototype analog lowpass filter
(3) Design analog lowpass filter
)(zGD)(sHD
)(sHD
)(sHLP)(sHLP
-
843Copyright 2005, S. K. Mitra
Design of IIR Design of IIR HighpassHighpass, , BandpassBandpass, , and and BandstopBandstop Digital FiltersDigital Filters
(4) Convert into using inverse frequency transformation used in Step 2(5) Design desired digital filter by applying bilinear transformation to
)(sHLP )(sHD
)(zGD)(sHD
44Copyright 2005, S. K. Mitra
Design of IIR Design of IIR HighpassHighpass, , BandpassBandpass, , and and BandstopBandstop Digital FiltersDigital Filters
Second Approach -(1) Prewarp digital frequency specifications of desired digital filter to arrive at frequency specifications of analog filter of same type(2) Convert frequency specifications of into that of prototype analog lowpass filter
)(zGD)(sHD
)(sHLP
)(sHD
45Copyright 2005, S. K. Mitra
Design of IIR Design of IIR HighpassHighpass, , BandpassBandpass, , and and BandstopBandstop Digital FiltersDigital Filters
(3) Design analog lowpass filter(4) Convert into an IIR digital transfer function using bilinear transformation(5) Transform into the desired digital transfer function
We illustrate the first approach
)(sHLP)(sHLP
)(zGLP
)(zGLP)(zGD
46Copyright 2005, S. K. Mitra
IIR IIR HighpassHighpass Digital Filter DesignDigital Filter Design Design of a Type 1 Chebyshev IIR digital
highpass filter Specifications: Hz, Hz,
dB, dB, kHz Normalized angular bandedge frequencies
700=pF 500=sF2=TF1= p 32=s
=== 7.02000
70022
T
pp F
F
=== 5.02000
50022T
ss F
F
47Copyright 2005, S. K. Mitra
IIR IIR HighpassHighpass Digital Filter DesignDigital Filter Design Prewarping these frequencies we get
For the prototype analog lowpass filter choose
Using we get Analog lowpass filter specifications: ,
, dB, dB
= pp
1= p962105.1=s
9626105.1)2/tan( == pp0.1)2/tan( == ss
1= p926105.1=s 1= p 32=s
48Copyright 2005, S. K. Mitra
IIR IIR HighpassHighpass Digital Filter DesignDigital Filter Design MATLAB code fragments used for the design
[N, Wn] = cheb1ord(1, 1.9626105, 1, 32, s)[B, A] = cheby1(N, 1, Wn, s);[BT, AT] = lp2hp(B, A, 1.9626105);[num, den] = bilinear(BT, AT, 0.5);
0 0.2 0.4 0.6 0.8 1-50
-40
-30
-20
-10
0
/
Gain
, dB
-
949Copyright 2005, S. K. Mitra
IIR IIR BandpassBandpass Digital Filter DesignDigital Filter Design Design of a Butterworth IIR digital bandpass
filter Specifications: , ,
, , dB, dB Prewarping we get
= 45.01p = 65.02p= 75.02s= 3.01s 1= p 40=s
8540807.0)2/tan( 11 == pp6318517.1)2/tan( 22 == pp
41421356.2)2/tan( 22 == ss5095254.0)2/tan( 11 == ss
50Copyright 2005, S. K. Mitra
IIR IIR BandpassBandpass Digital Filter DesignDigital Filter Design
Width of passband
We therefore modify so that and exhibit geometric symmetry with
respect to We set For the prototype analog lowpass filter we
choose
777771.0 12 == ppwB393733.1 21
2 == ppo2
21 23010325.1 oss =1 s
2 s1 s
2 o5773031.0 1 =s
1= p
51Copyright 2005, S. K. Mitra
IIR IIR BandpassBandpass Digital Filter DesignDigital Filter Design
Using we get
Specifications of prototype analog Butterworth lowpass filter:
, , dB,dB
w
op B
= 22
3617627.2777771.05773031.0
3332788.0393733.1 ==s
1= p 3617627.2=s 1= p40=s
52Copyright 2005, S. K. Mitra
IIR IIR BandpassBandpass Digital Filter DesignDigital Filter Design MATLAB code fragments used for the design
[N, Wn] = buttord(1, 2.3617627, 1, 40, s)[B, A] = butter(N, Wn, s);[BT, AT] = lp2bp(B, A, 1.1805647, 0.777771);[num, den] = bilinear(BT, AT, 0.5);
0 0.2 0.4 0.6 0.8 1-50
-40
-30
-20
-10
0
/
Gain
, dB
53Copyright 2005, S. K. Mitra
IIR IIR BandstopBandstop Digital Filter DesignDigital Filter Design Design of an elliptic IIR digital bandstop filter Specifications: , ,
, , dB, dB Prewarping we get
Width of stopband
= 45.01s = 65.02s= 75.02p= 3.01p 1= p 40=s
,8540806.0 1 =s ,6318517.1 2 =s,5095254.0 1 = p 4142136.2 2 = p
777771.0 12 == sswB393733.1 12
2 == sso2
12 230103.1 opp = 54Copyright 2005, S. K. Mitra
IIR IIR BandstopBandstop Digital Filter DesignDigital Filter Design We therefore modify so that and
exhibit geometric symmetry with respect to
We set For the prototype analog lowpass filter we
choose Using we get
1 p 1 p 2 p2 o
577303.0 1 = p1=s
22
=o
ws
B
0.42341263332787.0393733.1
777771.05095254.0 == p
-
10
55Copyright 2005, S. K. Mitra
IIR IIR BandstopBandstop Digital Filter DesignDigital 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 0.2 0.4 0.6 0.8 1-50
-40
-30
-20
-10
0
/
Gai
n, dB