Vous êtes sur la page 1sur 55

1

Copyright 2005, S. K. Mitra


Digital Filter Design
Digital 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)
2
Copyright 2005, S. K. Mitra
Digital Filter Specifications
Digital Filter Specifications
Usually, either the magnitudeand/or the
phase(delay) response is specified for the
design of digital filter for most applications
In some situations, the unit sample response
or the step responsemay be specified
In most practical applications, the problem
of interest is the development of a realizable
approximation to a given magnitude
response specification
3
Copyright 2005, S. K. Mitra
Digital Filter Specifications
Digital 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
H
LP
(e
j

)



0

c

c
1
H
HP
(e
j

)



1

c1

c1

c2

c2
H
BS
(e
j

)


1
1

c1

c1

c2

c2
H
BP
(e
j

)
4
Copyright 2005, S. K. Mitra
Digital Filter Specifications
Digital 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
passbandand in the stopbandare given with
some acceptable tolerances
In addition, a transition band is specified
between the passbandand stopband
5
Copyright 2005, S. K. Mitra
Digital Filter Specifications
Digital Filter Specifications
For example, the magnitude response
of a digital lowpassfilter may be given as
indicated below
) (
j
e G
6
Copyright 2005, S. K. Mitra
Digital Filter Specifications
Digital 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 ) (
j
e G
0 ) (
j
e G
s

p

p
0

s
p p
j
p
e G +

, 1 ) ( 1

s s
j
e G , ) (
7
Copyright 2005, S. K. Mitra
Digital Filter Specifications
Digital 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
p

) (
j
e G
) (
j
e G
0
8
Copyright 2005, S. K. Mitra
Digital Filter Specifications
Digital Filter Specifications
Specifications are often given in terms of
loss function A in
dB
Peak passband ripple
dB
Minimum stopband attenuation
dB
) ( log 20 ) (
10

=
j
e G
) 1 ( log 20
10 p p
=
) ( log 20
10 s s
=
9
Copyright 2005, S. K. Mitra
Digital Filter Specifications
Digital Filter Specifications
Magnitude specifications may alternately be
given in a normalized form as indicated
below
10
Copyright 2005, S. K. Mitra
Digital Filter Specifications
Digital Filter Specifications
Here, the maximum value of the magnitude
in the passbandis assumed to be unity
- Maximum passbanddeviation,
given by the minimum value of the
magnitude in the passband
- Maximum stopbandmagnitude
A
1
2
1 / 1 +
11
Copyright 2005, S. K. Mitra
Digital Filter Specifications
Digital Filter Specifications
For the normalized specification, maximum
value of the gain function or the minimum
value of the loss function is0 dB
Maximum passband attenuation -
dB
For , it can be shown that
dB
( )
2
10 max
1 log 20 + =
1 <<
p
) 2 1 ( log 20
10 max p

12
Copyright 2005, S. K. Mitra
Digital Filter Specifications
Digital Filter Specifications
In practice, passbandedge frequency
and stopbandedge frequency are
specified in Hz
For digital filter design, normalized
bandedgefrequencies need to be computed
from specifications in Hz using
T F
F
F
F
p
T
p
T
p
p
=

= 2
2
T F
F
F
F
s
T
s
T
s
s
=

= 2
2
s
F
p
F
13
Copyright 2005, S. K. Mitra
Digital Filter Specifications
Digital Filter Specifications
Example- Let kHz, kHz, and
kHz
Then
7 =
p
F 3 =
s
F
25 =
T
F
=


= 56 . 0
10 25
) 10 7 ( 2
3
3
p
=


= 24 . 0
10 25
) 10 3 ( 2
3
3
s
14
Copyright 2005, S. K. Mitra
Selection of Filter Type
Selection of Filter Type
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
1
z
N M
z d z d z d d
z p z p z p p
z H
N
N
M
M

+ + + +
+ + + +
=


, ) (
2
2
1
1 0
2
2
1
1 0
L
L
15
Copyright 2005, S. K. Mitra
Selection of Filter Type
Selection 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
n
z n h z H
0
] [ ) (
] [ ] [ n N h n h =
1
z
16
Copyright 2005, S. K. Mitra
Selection of Filter Type
Selection 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
17
Copyright 2005, S. K. Mitra
Digital Filter Design:
Digital Filter Design:
Basic Approaches
Basic Approaches
Most common approach to IIR filter design-
(1) Convert the digital filter specifications
into an analog prototype lowpassfilter
specifications
(2) Determine the analog lowpassfilter
transfer function
(3) Transform into the desired digital
transfer function
) (s H
a
) (z G
) (s H
a
18
Copyright 2005, S. K. Mitra
Digital Filter Design:
Digital Filter Design:
Basic Approaches
Basic 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
19
Copyright 2005, S. K. Mitra
Digital Filter Design:
Digital Filter Design:
Basic Approaches
Basic 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
) (
) (
) (
s D
s P
s H
a
a
a
=
) (
) (
) (
z D
z P
z G =
) (s H
a
20
Copyright 2005, S. K. Mitra
Digital Filter Design:
Digital Filter Design:
Basic Approaches
Basic 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
) (s H
a
) (z G
j
21
Copyright 2005, S. K. Mitra
Digital Filter Design:
Digital Filter Design:
Basic Approaches
Basic 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 samples
or the (N+1) samples of its frequency
response
{ } ] [n h
) (
j
e H
22
Copyright 2005, S. K. Mitra
Digital Filter Design:
Digital Filter Design:
Basic Approaches
Basic Approaches
Three commonly used approaches to FIR
filter design-
(1) Windowed Fourier series approach
(2) Frequency sampling approach
(3) Computer-based optimization methods
23
Copyright 2005, S. K. Mitra
IIR Digital Filter Design: Bilinear
IIR Digital Filter Design: Bilinear
Transformation Method
Transformation 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
1
1
2
z
z
T
s
) (s H
a

=
=
1
1
1
1
2
) ( ) (
z
z
T
s
a
s H z G
24
Copyright 2005, S. K. Mitra
Bilinear Transformation
Bilinear 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 = 2is chosen for convenience
) (s H
a
) (s H
a
) (s H
a
25
Copyright 2005, S. K. Mitra
Bilinear Transformation
Bilinear Transformation
Inverse bilinear transformation for T = 2is
For
Thus,
s
s
z

+
=
1
1
o o
j s + =
2 2
2 2
2
) 1 (
) 1 (
) 1 (
) 1 (
o o
o o
o o
o o
z
j
j
z
+
+ +
=

+ +
=
1 0 = = z
o
1 0 < < z
o
1 0 > > z
o
26
Copyright 2005, S. K. Mitra
Bilinear Transformation
Bilinear Transformation
Mapping of s-plane into the z-plane
27
Copyright 2005, S. K. Mitra
Bilinear Transformation
Bilinear Transformation
For with T = 2we have
or
) (
) (
1
1
2 / 2 / 2 /
2 / 2 / 2 /




+

=
+

=
j j j
j j j
j
j
e e e
e e e
e
e
j

=
j
e z
) 2 / tan( =
) 2 / tan(
) 2 / cos( 2
) 2 / sin( 2
=

= j
j
28
Copyright 2005, S. K. Mitra
Bilinear Transformation
Bilinear 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
29
Copyright 2005, S. K. Mitra
Bilinear Transformation
Bilinear Transformation
Nonlinear mapping introduces a distortion
in the frequency axis called frequency
warping
Effect of warping shown below
= tan(/2)
30
Copyright 2005, S. K. Mitra
Bilinear Transformation
Bilinear 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
) , (
s p

) , (
s p

) (s H
a
) (s H
a
31
Copyright 2005, S. K. Mitra
IIR Digital Filter Design Using
IIR Digital Filter Design Using
Bilinear Transformation
Bilinear Transformation
Example- Consider
Applying bilinear transformation to the above
we get the transfer function of a first-order
digital lowpassButterworth filter
c
c
a
s
s H
+

= ) (
) 1 ( ) 1 (
) 1 (
) ( ) (
1 1
1
1
1
1
1

=
+ +
+
= =
z z
z
s H z G
c
c
z
z
s
a
32
Copyright 2005, S. K. Mitra
IIR Digital Filter Design Using
IIR Digital Filter Design Using
Bilinear Transformation
Bilinear Transformation
Rearranging terms we get
where
1
1
1
1
2
1
) (

=
z
z
z G

) 2 / tan( 1
) 2 / tan( 1
1
1
c
c
c
c
+

=
+

=
33
Copyright 2005, S. K. Mitra
IIR Digital Filter Design Using
IIR Digital Filter Design Using
Bilinear Transformation
Bilinear 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
2 2
2 2
) (
o
o
a
s B s
s
s H
+ +
+
=
0 ) ( =
o a
j H
1 ) ( ) 0 ( = = j H j H
a a
o

2 / 1 ) ( ) (
1 2
= = j H j H
a a
1 2
= B
34
Copyright 2005, S. K. Mitra
IIR Digital Filter Design Using
IIR Digital Filter Design Using
Bilinear Transformation
Bilinear Transformation
Then
where
1
1
1
1
) ( ) (

=
=
z
z
s
a
s H z G
2 2 1 2 2
2 2 1 2 2
) 1 ( ) 1 ( 2 ) 1 (
) 1 ( ) 1 ( 2 ) 1 (


+ + + +
+ + +
=
z B z B
z z
o o o
o o o
2 1
2 1
) 1 ( 2 1
2 1
2
1


+ +
+

+
=
z z
z z


o
o
o
=
+

= cos
1
1
2
2
) 2 / tan( 1
) 2 / tan( 1
1
1
2
2
w
w
o
o
B
B
B
B
+

=
+ +
+
=
35
Copyright 2005, S. K. Mitra
IIR Digital Filter Design Using
IIR Digital Filter Design Using
Bilinear Transformation
Bilinear Transformation
Example- Design a 2nd-order digital notch
filter operating at a sampling rate of 400 Hz
with a notch frequency at 60 Hz, 3-dB notch
bandwidth of 6 Hz
Thus
From the above values we get
= = 3 . 0 ) 400 / 60 ( 2
o
= = 03 . 0 ) 400 / 6 ( 2
w
B
90993 . 0 =
587785 . 0 =
36
Copyright 2005, S. K. Mitra
IIR Digital Filter Design Using
IIR Digital Filter Design Using
Bilinear Transformation
Bilinear Transformation
Thus
The gain and phase responses are shown below
2 1
2 1
90993 . 0 1226287 . 1 1
954965 . 0 1226287 . 1 954965 . 0
) (


+
+
=
z z
z z
z G
0 50 100 150 200
-40
-30
-20
-10
0
Frequency, Hz
G
a
i
n
,

d
B
0 50 100 150 200
-2
-1
0
1
2
Frequency, Hz
P
h
a
s
e
,

r
a
d
i
a
n
s
37
Copyright 2005, S. K. Mitra
IIR
IIR
Lowpass
Lowpass
Digital Filter Design
Digital Filter Design
Using Bilinear Transformation
Using Bilinear Transformation
Example- Design a lowpassButterworth
digital filter with , ,
dB, and dB
Thus
If this implies
= 25 . 0
p
= 55 . 0
s
15
s
5 . 0
p
5 . 0 ) ( log 20
25 . 0
10

j
e G
15 ) ( log 20
55 . 0
10

j
e G
1 ) (
0
=
j
e G
1220185 . 0
2
=
622777 . 31
2
= A
38
Copyright 2005, S. K. Mitra
IIR
IIR
Lowpass
Lowpass
Digital Filter Design
Digital Filter Design
Using Bilinear Transformation
Using Bilinear Transformation
Prewarpingwe get
The inverse transition ratio is
The inverse discrimination ratio is
4142136 . 0 ) 2 / 25 . 0 tan( ) 2 / tan( = = =
p p
1708496 . 1 ) 2 / 55 . 0 tan( ) 2 / tan( = = =
s s
8266809 . 2
1
=

=
p
s
k
841979 . 15
1 1
2
1
=


=
A
k
39
Copyright 2005, S. K. Mitra
IIR
IIR
Lowpass
Lowpass
Digital Filter Design
Digital Filter Design
Using Bilinear Transformation
Using Bilinear Transformation
Thus
We chooseN = 3
To determine we use
6586997 . 2
) / 1 ( log
) / 1 ( log
10
1 10
= =
k
k
N
c

2 2
2
1
1
) / ( 1
1
) (
+
=
+
=
N
c p
p a
j H
40
Copyright 2005, S. K. Mitra
IIR
IIR
Lowpass
Lowpass
Digital Filter Design
Digital Filter Design
Using Bilinear Transformation
Using Bilinear Transformation
We then get
3rd-order lowpassButterworth transfer
function for is
Denormalizingto get we
arrive at
588148 . 0 ) ( 419915 . 1 = =
p c
1 =
c
) 1 )( 1 (
1
) (
2
+ + +
=
s s s
s H
an


s
588148 . 0 =
c

=
588148 . 0
) ( H s H
an a
41
Copyright 2005, S. K. Mitra
IIR
IIR
Lowpass
Lowpass
Digital Filter Design
Digital Filter Design
Using Bilinear Transformation
Using Bilinear Transformation
Applying bilinear transformation to
we get the desired digital transfer function
Magnitude and gain responses of G(z) shown
below:
) (s H
a
1
1
1
1
) ( ) (

=
=
z
z
s
a
s H z G
0 0.2 0.4 0.6 0.8 1
0
0.2
0.4
0.6
0.8
1
/
M
a
g
n
i
t
u
d
e
0 0.2 0.4 0.6 0.8 1
-40
-30
-20
-10
0
/
G
a
i
n
,

d
B
42
Copyright 2005, S. K. Mitra
Design of IIR
Design of IIR
Highpass
Highpass
,
,
Bandpass
Bandpass
,
,
and
and
Bandstop
Bandstop
Digital Filters
Digital Filters
First Approach-
(1) Prewarpdigital 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 lowpassfilter
(3) Design analog lowpassfilter
) (z G
D
) (s H
D
) (s H
D
) (s H
LP
) (s H
LP
43
Copyright 2005, S. K. Mitra
Design of IIR
Design of IIR
Highpass
Highpass
,
,
Bandpass
Bandpass
,
,
and
and
Bandstop
Bandstop
Digital Filters
Digital Filters
(4) Convert into using
inverse frequency transformation used in
Step 2
(5) Design desired digital filter by
applying bilinear transformation to
) (s H
LP
) (s H
D
) (z G
D
) (s H
D
44
Copyright 2005, S. K. Mitra
Design of IIR
Design of IIR
Highpass
Highpass
,
,
Bandpass
Bandpass
,
,
and
and
Bandstop
Bandstop
Digital Filters
Digital Filters
Second Approach-
(1) Prewarpdigital 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 lowpassfilter
) (z G
D
(s H
D
) (s H
LP
(s
)
H
D
)
45
Copyright 2005, S. K. Mitra
Design of IIR
Design of IIR
Highpass
Highpass
,
,
Bandpass
Bandpass
,
,
and
and
Bandstop
Bandstop
Digital Filters
Digital Filters
(3) Design analog lowpassfilter
(4) Convert into an IIR digital
transfer function using bilinear
transformation
(5) Transform into the desired
digital transfer function
We illustrate the first approach
) (s H
LP
) (s H
LP
) (z G
LP
) (z G
LP
) (z G
D
46
Copyright 2005, S. K. Mitra
IIR
IIR
Highpass
Highpass
Digital Filter Design
Digital Filter Design
Design of a Type 1 ChebyshevIIR digital
highpassfilter
Specifications: Hz, Hz,
dB, dB, kHz
Normalized angular bandedgefrequencies
700 =
p
F 500 =
s
F
2 =
T
F 1 =
p
32 =
s
=

=

= 7 . 0
2000
700 2
2
T
p
p
F
F
=

=

= 5 . 0
2000
500 2 2
T
s
s
F
F
47
Copyright 2005, S. K. Mitra
IIR
IIR
Highpass
Highpass
Digital Filter Design
Digital Filter Design
Prewarpingthese frequencies we get
For the prototype analog lowpassfilter choose
Using we get
Analog lowpassfilter specifications: ,
, dB, dB

p p
1 =
p
962105 . 1 =
s
9626105 . 1 ) 2 / tan(

= =
p p
0 . 1 ) 2 / tan(

= =
s s
1 =
p
926105 . 1 =
s
1 =
p
32 =
s
48
Copyright 2005, S. K. Mitra
IIR
IIR
Highpass
Highpass
Digital Filter Design
Digital 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
/
G
a
i
n
,

d
B
49
Copyright 2005, S. K. Mitra
IIR
IIR
Bandpass
Bandpass
Digital Filter Design
Digital Filter Design
Design of a Butterworth IIR digital bandpass
filter
Specifications: , ,
, , dB, dB
Prewarpingwe get
= 45 . 0
1 p
= 65 . 0
2 p
= 75 . 0
2 s
= 3 . 0
1 s
1 =
p
40 =
s
8540807 . 0 ) 2 / tan(

1 1
= =
p p
6318517 . 1 ) 2 / tan(

2 2
= =
p p
41421356 . 2 ) 2 / tan(

2 2
= =
s s
5095254 . 0 ) 2 / tan(

1 1
= =
s s
50
Copyright 2005, S. K. Mitra
IIR
IIR
Bandpass
Bandpass
Digital Filter Design
Digital Filter Design
Width of passband
We therefore modify so that and
exhibit geometric symmetry with
respect to
We set
For the prototype analog lowpassfilter we
choose
777771 . 0

1 2
= =
p p w
B
393733 . 1

2 1
2
= =
p p o
2
2 1

23010325 . 1

o s s
=
1

5773031 . 0

1
=
s
1 =
p
51
Copyright 2005, S. K. Mitra
IIR
IIR
Bandpass
Bandpass
Digital Filter Design
Digital Filter Design
Using we get
Specifications of prototype analog
Butterworth lowpassfilter:
, , dB,
dB
w
o
p
B

=


2 2
3617627 . 2
777771 . 0 5773031 . 0
3332788 . 0 393733 . 1
=

=
s
1 =
p
3617627 . 2 =
s
1 =
p
40 =
s
52
Copyright 2005, S. K. Mitra
IIR
IIR
Bandpass
Bandpass
Digital Filter Design
Digital 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
/
G
a
i
n
,

d
B
53
Copyright 2005, S. K. Mitra
IIR
IIR
Bandstop
Bandstop
Digital Filter Design
Digital Filter Design
Design of an elliptic IIR digital bandstopfilter
Specifications: , ,
, , dB, dB
Prewarpingwe get
Width of stopband
= 45 . 0
1 s
= 65 . 0
2 s
= 75 . 0
2 p
= 3 . 0
1 p
1 =
p
40 =
s
, 8540806 . 0

1
=
s
, 6318517 . 1

2
=
s
, 5095254 . 0

1
=
p
4142136 . 2

2
=
p
777771 . 0

1 2
= =
s s w
B
393733 . 1

1 2
2
= =
s s o
2
1 2

230103 . 1

o p p
=
54
Copyright 2005, S. K. Mitra
IIR
IIR
Bandstop
Bandstop
Digital Filter Design
Digital Filter Design
We therefore modify so that and
exhibit geometric symmetry with respect to
We set
For the prototype analog lowpassfilter we
choose
Using we get
1

577303 . 0

1
=
p
1 =
s
2 2

=
o
w
s
B
0.4234126
3332787 . 0 393733 . 1
777771 . 0 5095254 . 0
=

=
p
55
Copyright 2005, S. K. Mitra
IIR
IIR
Bandstop
Bandstop
Digital Filter Design
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 0.2 0.4 0.6 0.8 1
-50
-40
-30
-20
-10
0
/
G
a
i
n
,

d
B

Vous aimerez peut-être aussi