1
Copyright © 2005, S. K. Mitra
Simple Digital Filters Simple Digital Filters
• Later in the course we shall review various methods of designing frequency-selective filters satisfying prescribed specifications
• We now describe several low-order FIR and IIR digital filters with reasonable selective frequency responses that often are satisfactory in a number of applications
2
Copyright © 2005, S. K. Mitra
Simple FIR Digital Filters Simple FIR Digital Filters
• FIR digital filters considered here have integer-valued impulse response coefficients
• These filters are employed in a number of practical applications, primarily because of their simplicity, which makes them amenable to inexpensive hardware implementations
3
Copyright © 2005, S. K. Mitra
Simple FIR Digital Filters Simple FIR Digital Filters
Lowpass FIR Digital Filters
• The simplest lowpass FIR digital filter is the 2-point moving-average filter given by
• The above transfer function has a zero at and a pole atz= 0
• Note that here the pole vectorhas a unity magnitude for all values ofω
z z z
z
H 2
1 1 1
2 0 1
= + +
= ( − ) )
(
−1
= z
4
Copyright © 2005, S. K. Mitra
Simple FIR Digital Filters Simple FIR Digital Filters
• On the other hand, asωincreases from0to π, the magnitude of the zero vector
decreases from a value of2, the diameter of the unit circle, to0
• Hence, the magnitude response is a monotonically decreasing function of ω fromω= 0toω= π
| ) (
|H0 ejω
5
Copyright © 2005, S. K. Mitra
Simple FIR Digital Filters Simple FIR Digital Filters
• The maximum value of the magnitude function is1 atω= 0, and the minimum value is0 atω= π, i.e.,
• The frequency response of the above filter is given by
0
1 0
0
0( )|= , | ( )|=
|H ej H ejπ
) 2 / cos(
)
( /2
0 ejω =e−jω ω H
6
Copyright © 2005, S. K. Mitra
Simple FIR Digital Filters Simple FIR Digital Filters
• The magnitude response can be seen to be a monotonically decreasing function ofω
) 2 / cos(
| ) (
|H0 ejω = ω
0 0.2 0.4 0.6 0.8 1
0 0.2 0.4 0.6 0.8 1
ω/π
Magnitude
First-order FIR lowpass filter
7
Copyright © 2005, S. K. Mitra
Simple FIR Digital Filters Simple FIR Digital Filters
• The frequency at which
is of practical interest since here the gain in dBis given by
since the dc gain ωc
= ω
) 2 (
) 1
( 0 0
0 j j
e H e
H ωc =
) (ωc G
dB 3 2 log 20 ) ( log
20 10 0 − 10 ≅−
= H ej
) (ωc
G 20log10 ( c)
ej
H ω
=
0 20
0 0
10 =
= log ( ) )
( H ej
G
8
Copyright © 2005, S. K. Mitra
Simple FIR Digital Filters Simple FIR Digital Filters
• Thus, the gainG(ω) at is
approximately3 dB less than the gain at ω
= 0
• As a result, is called the3-dB cutoff frequency
• To determine the value of we set which yields
ωc
= ω
ωc
ωc
2 π/
=
ωc 2
2 1 2
0( )| cos ( /2)
|H ejωc = ωc =
9
Copyright © 2005, S. K. Mitra
Simple FIR Digital Filters Simple FIR Digital Filters
• The 3-dBcutoff frequency can be considered as the passband edge frequency
• As a result, for the filter the passband width is approximatelyπ/2
• The stopband is fromπ/2 toπ
• Note: has a zero at orω= π, which is in the stopband of the filter
ωc
) (z H0
) (z
H0 z=−1
10
Copyright © 2005, S. K. Mitra
Simple FIR Digital Filters Simple FIR Digital Filters
• A cascade of the simple FIR filter results in an improved lowpass frequency response as illustrated below for a cascade of3 sections
) ( )
( 21 1
0 z = 1+z− H
0 0.2 0.4 0.6 0.8 1
0 0.2 0.4 0.6 0.8 1
ω/π
Magnitude
First-order FIR lowpass filter cascade
Simple FIR Digital Filters Simple FIR Digital Filters
• The 3-dB cutoff frequencyof a cascade of Msections is given by
• For M= 3, the above yields
• Thus, the cascade of first-order sections yields a sharper magnitude response but at the expense of a decrease in the width of the passband
) 2 ( cos
2 1 1/2M
c= − −
ω
π
= ωc 0.302
Simple FIR Digital Filters Simple FIR Digital Filters
• A better approximation to the ideal lowpass filter is given by a higher-order moving- average filter
• Signals with rapid fluctuations in sample values are generally associated with high- frequency components
• These high-frequency components are essentially removed by an moving-average filter resulting in a smoother output
13
Copyright © 2005, S. K. Mitra
Simple FIR Digital Filters Simple FIR Digital Filters
Highpass FIR Digital Filters
• The simplest highpass FIR filter is obtained from the simplest lowpass FIR filter by replacingzwith
• This results in
) ( )
( 1
2 1 1 z = 1−z− H
−z
14
Copyright © 2005, S. K. Mitra
Simple FIR Digital Filters Simple FIR Digital Filters
• Corresponding frequency response is given by
whose magnitude response is plotted below ) 2 / sin(
)
( /2
1ejω = je−jω ω H
0 0.2 0.4 0.6 0.8 1
0 0.2 0.4 0.6 0.8 1
ω/π
Magnitude
First-order FIR highpass filter
15
Copyright © 2005, S. K. Mitra
Simple FIR Digital Filters Simple FIR Digital Filters
• The monotonically increasing behavior of the magnitude function can again be demonstrated by examining the pole-zero pattern of the transfer function
• The highpass transfer function has a zero atz= 1 orω= 0 which is in the stopband of the filter
) (z H1
) (z H1
16
Copyright © 2005, S. K. Mitra
Simple FIR Digital Filters Simple FIR Digital Filters
• Improved highpass magnitude response can again be obtained by cascading several sections of the first-order highpass filter
• Alternately, a higher-order highpass filter of the form
is obtained by replacingzwith in the transfer function of a moving average filter
−z
n M
n n
M z
z
H =
∑
=−01− − 11( ) ( 1)
17
Copyright © 2005, S. K. Mitra
Simple FIR Digital Filters Simple FIR Digital Filters
• An application of the FIR highpass filters is in moving-target-indicator (MTI) radars
• In these radars, interfering signals, called clutters, are generated from fixed objects in the path of the radar beam
• The clutter, generated mainly from ground echoes and weather returns, has frequency components near zero frequency (dc)
18
Copyright © 2005, S. K. Mitra
Simple FIR Digital Filters Simple FIR Digital Filters
• The clutter can be removed by filtering the radar return signal through atwo-pulse canceler, which is the first-order FIR highpass filter
• For a more effective removal it may be necessary to use a three-pulse canceler obtained by cascading two two-pulse cancelers
) ( )
( 21 1
1 z = 1−z− H
19
Copyright © 2005, S. K. Mitra
Simple IIR Digital Filters Simple IIR Digital Filters
Lowpass IIR Digital Filters
• We have shown earlier that the first-order causal IIR transfer function
has a lowpass magnitude responsefor α> 0 1
0 , 1 )
( 1 <α<
α
= − − z z K H
20
Copyright © 2005, S. K. Mitra
Simple IIR Digital Filters Simple IIR Digital Filters
• An improved lowpass magnitude response is obtained by adding a factor to the numerator of transfer function
• This forces the magnitude response to have a zero at ω= πin the stopbandof the filter
) 1 ( +z−1
1 0 1 ,
) 1 ) (
( 1
1 <α<
α
−
= + −− z
z z K
H
21
Copyright © 2005, S. K. Mitra
Simple IIR Digital Filters Simple IIR Digital Filters
• On the other hand, the first-order causal IIR transfer function
has a highpass magnitude responsefor α< 0
0 1 , 1 )
( 1 − <α<
α
= − − z z K H
22
Copyright © 2005, S. K. Mitra
Simple IIR Digital Filters Simple IIR Digital Filters
• However, the modified transfer function obtained with the addition of a factor
to the numerator
exhibits a lowpass magnitude response )
1 ( +z−1
0 1 1 ,
) 1 ) (
( 1
1 − <α<
α
−
= + −− z
z z K
H
Simple IIR Digital Filters Simple IIR Digital Filters
• The modified first-order lowpass transfer functionfor both positive and negative values of αis then given by
• As ωincreases from 0to π, the magnitude of the zero vectordecreases from a value of 2to 0
1 0 , 1
) 1 ) (
( 1
1 <α<
α
−
= + −− z z z K
HLP
Simple IIR Digital Filters Simple IIR Digital Filters
• The maximum values of the magnitude function is at ω= 0and the minimum value is 0at ω= π, i.e.,
• Therefore, is a monotonically decreasing functionof ωfrom ω= 0to ω= π
) 1 /(
2K −α
0 ) ( 1 ,
) 2
( 0 =
α
= − LP jπ
j
LP K H e
e H
| ) (
|HLP ejω
25
Copyright © 2005, S. K. Mitra
Simple IIR Digital Filters Simple IIR Digital Filters
• For most applications, it is usual to have a dc gainof 0dB, that is to have
• To this end, we choose resulting in the first-order IIR lowpass transfer function
• The above transfer function has a zero at i.e., at ω= π which is in the stopband
1 0 , 1
1 2 ) 1
( 1
1 ⎟⎟ <α<
⎠
⎞
⎜⎜
⎝
⎛ α
− + α
= − −−
z z z
HLP
1
| ) (
|H ej0 = 2 / ) 1 ( −α
= K
26
Copyright © 2005, S. K. Mitra
Simple IIR Digital Filters Simple IIR Digital Filters
Lowpass IIR Digital Filters
• A first-order causal lowpass IIR digital filter has a transfer function given by
where|α| < 1 for stability
• The above transfer function has a zero at i.e., atω= π which is in the stopband
⎟⎟⎠
⎞
⎜⎜⎝
⎛ α
− + α
= − −1−1 1
1 2 ) 1 (
z z z
HLP
−1
= z
27
Copyright © 2005, S. K. Mitra
Simple IIR Digital Filters Simple IIR Digital Filters
• has a real pole atz= α
• As ωincreases from 0to π, the magnitude of the zero vectordecreases from a value of 2to 0, whereas, for a positive value of α, the magnitude of the pole vectorincreases from a value of to
• The maximum value of the magnitude function is1atω= 0, and the minimum value is0atω= π
α
−
1 1+α
) (z HLP
28
Copyright © 2005, S. K. Mitra
Simple IIR Digital Filters Simple IIR Digital Filters
• i.e.,
• Therefore, is a monotonically decreasing function ofωfromω= 0 toω= π as indicated below
0
| ) (
| , 1
| ) (
|HLP ej0 = HLP ejπ =
| ) (
|HLP ejω
0 0.2 0.4 0.6 0.8 1
0 0.2 0.4 0.6 0.8 1
ω/π
Magnitude
α = 0.8 α = 0.7 α = 0.5
10-2 10-1 100
-20 -15 -10 -5 0
ω/π Gain, dB α = 0.8
α = 0.7 α = 0.5
29
Copyright © 2005, S. K. Mitra
Simple IIR Digital Filters Simple IIR Digital Filters
• The squared magnitude function is given by
• The derivative of with respect toωis given by
) cos 2 1 ( 2
) cos 1 ( ) 1
| ( ) (
| 2
2 2
ω α
− α +
ω + α
= −
ω j LP e H
|2
) (
|HLP ejω
2 2 2 2
2
) cos 2 1 ( 2
sin ) 2 1 ( ) 1 (
| ) (
|
α + ω α
−
ω α + α + α
−
=− ω
ω
d e H d LP j
30
Copyright © 2005, S. K. Mitra
Simple IIR Digital Filters Simple IIR Digital Filters
in the range verifying again the monotonically decreasing behavior of the magnitude function
• To determine the3-dB cutoff frequency we set
in the expression for the square magnitude function resulting in
0 /
| ) (
|H eω 2dω≤
d LP j 0≤ω≤π
2
| 1 ) (
|HLP ejωc 2=
31
Copyright © 2005, S. K. Mitra
Simple IIR Digital Filters Simple IIR Digital Filters
or
which when solved yields
• The above quadratic equation can be solved for αyielding two solutions
2 1 ) cos 2 1 ( 2
) cos 1 ( ) 1 (
2
2 =
ω α
− α +
ω + α
−
c c
c
c = +α − α ω
ω + α
− ) (1 cos ) 1 2 cos 1
( 2 2
1 2
cos 2
α +
= α ωc
32
Copyright © 2005, S. K. Mitra
Simple IIR Digital Filters Simple IIR Digital Filters
• The solution resulting in a stabletransfer function is given by
• It follows from
that is a BR functionfor|α| < 1 ) cos 2 1 ( 2
) cos 1 ( ) 1
| ( ) (
| 2
2 2
ω α
− α +
ω + α
= −
ω j LP e H
) (z HLP
) (z HLP
c
ωωc
= − α cos
sin 1
33
Copyright © 2005, S. K. Mitra
Simple IIR Digital Filters Simple IIR Digital Filters
Highpass IIR Digital Filters
• A first-order causal highpassIIR digital filter has a transfer function given by
where|α| < 1 for stability
• The above transfer function has a zero at z= 1 i.e., atω= 0 which is in the stopband
⎟⎟
⎠
⎞
⎜⎜
⎝
⎛
−
−
= + −−
1 1
1 1 2 1
z z z
HHP
α ) α
(
34
Copyright © 2005, S. K. Mitra
Simple IIR Digital Filters Simple IIR Digital Filters
• Its 3-dB cutoff frequency is given by
which is the same as that of
• Magnitude and gain responses of are shown below
c
c ω
ω
−
=
α (1 sin )/cos ωc
) (z HLP
) (z HHP
10-2 10-1 100
-20 -15 -10 -5 0
ω/π
Gain, dB
α = 0.8 α = 0.7 α = 0.5
0 0.2 0.4 0.6 0.8 1
0 0.2 0.4 0.6 0.8 1
ω/π
Magnitude
α = 0.8 α = 0.7 α = 0.5
Simple IIR Digital Filters Simple IIR Digital Filters
• is a BR function for|α| < 1
• Example -Design a first-order highpass digital filter with a 3-dB cutoff frequency of 0.8π
• Now, and
• Therefore ) (z HHP
587785 . 0 ) 8 . 0 sin(
)
sin(ωc = π = 80902 . 0 ) 8 . 0 cos( π =−
5095245 .
0 cos / ) sin 1
( − ω ω =−
=
α c c
Simple IIR Digital Filters Simple IIR Digital Filters
• Therefore,
⎟⎟
⎠
⎞
⎜⎜
⎝
⎛ +
= − − −
1 1
5095245 0
1 245238 1 0
z z . .
⎟⎟
⎠
⎞
⎜⎜
⎝
⎛
−
−
= + −−
1 1
1 1 2 1
z z z
HHP
α ) α
(
37
Copyright © 2005, S. K. Mitra
Simple IIR Digital Filters Simple IIR Digital Filters
Bandpass IIR Digital Filters
• A 2nd-order bandpass digital transfer function is given by
• Its squared magnitude function is
⎟⎟⎠
⎜⎜ ⎞
⎝
⎛
α + α + β
−
− α
= − −−21 −2 )
1 ( 1
1 2
) 1
( z z
z z HBP
)2
( jω
BP e H
] 2 cos 2 cos ) 1 ( 2 )
1 ( 1 [ 2
) 2 cos 1 ( ) 1 (
2 2
2 2
2
ω α + ω α + β
− α + α + β +
ω
− α
= −
38
Copyright © 2005, S. K. Mitra
Simple IIR Digital Filters Simple IIR Digital Filters
• goes to zero atω= 0 andω=π
• It assumes a maximum value of1 at , called the center frequencyof the bandpass filter, where
• The frequencies and where becomes1/2 are called the3-dB cutoff frequencies
|2
) (
|HBP ejω
|2
) (
|HBP ejω ωo
= ω
) ( cos 1β
= ωo −
1
ωc ωc2
39
Copyright © 2005, S. K. Mitra
Simple IIR Digital Filters Simple IIR Digital Filters
• The difference between the two cutoff frequencies, assuming is called the3-dB bandwidthand is given by
• The transfer function is a BR function if|α| < 1 and|β| < 1
1
2 c
c >ω ω
) (z HBP
1 1 2−ω =cos− ω
= c c
Bw ⎟
⎠
⎜ ⎞
⎝
⎛ α +
α 1 2
2
40
Copyright © 2005, S. K. Mitra
Simple IIR Digital Filters Simple IIR Digital Filters
• Plots of are shown below|HBP(ejω)|
0 0.2 0.4 0.6 0.8 1
0 0.2 0.4 0.6 0.8 1
ω/π
Magnitude
β = 0.34 α = 0.8 α = 0.5 α = 0.2
0 0.2 0.4 0.6 0.8 1
0 0.2 0.4 0.6 0.8 1
ω/π
Magnitude
α = 0.6 β = 0.8 β = 0.5 β = 0.2
41
Copyright © 2005, S. K. Mitra
Simple IIR Digital Filters Simple IIR Digital Filters
• Example -Design a 2ndorder bandpass digital filter with center frequency at0.4π and a 3-dB bandwidthof0.1π
• Here and
• The solution of the above equation yields:
α= 1.376382 andα= 0.72654253
9510565 .
0 ) 1 . 0 cos(
) cos(
1 2
2= = π =
α +
α
Bw
309017 . 0 ) 4 . 0 cos(
)
cos(ω = π =
=
β o
42
Copyright © 2005, S. K. Mitra
Simple IIR Digital Filters Simple IIR Digital Filters
• The corresponding transfer functions are
and
• The poles of are atz= 0.3671712 and have a magnitude> 1
± 11425636
1.
j
2 1
2
37638 1 7343424 0
1 18819 1
0 − −
−
+
−
− −
=
z z
z z HBP
. .
. )
' (
2 1
2
72654253 0
533531 0 1 13673 1
0 − −
−
+
−
= −
z z
z z HBP
. .
. )
" (
)
' (z
HBP
43
Copyright © 2005, S. K. Mitra
Simple IIR Digital Filters Simple IIR Digital Filters
• Thus, the poles of are outside the unit circle making the transfer function unstable
• On the other hand, the poles of are atz= and have a magnitude of0.8523746
• Hence is BIBO stable
• Later we outline a simpler stability test )
' (z
HBP
)
" (z HBP 8095546 0
2667655
0. ± j .
)
" (z HBP
44
Copyright © 2005, S. K. Mitra
Simple IIR Digital Filters Simple IIR Digital Filters
• Figures below show the plots of the magnitude function and the group delay of
)
" (z HBP
0 0.2 0.4 0.6 0.8 1
0 0.2 0.4 0.6 0.8 1
ω/π
Magnitude
0 0.2 0.4 0.6 0.8 1
-1 0 1 2 3 4 5 6 7
ω/π
Group delay, samples
45
Copyright © 2005, S. K. Mitra
Simple IIR Digital Filters Simple IIR Digital Filters
Bandstop IIR Digital Filters
• A 2nd-order bandstop digital filter has a transfer function given by
• The transfer function is a BR function if|α| < 1 and|β| < 1
⎟⎟⎠
⎞
⎜⎜⎝
⎛
α + α + β
−
+ β
− α
= + −1−1 −2 −2 )
1 ( 1
2 1 2 ) 1 (
z z
z z z
HBS
) (z HBS
46
Copyright © 2005, S. K. Mitra
Simple IIR Digital Filters Simple IIR Digital Filters
• Its magnitude response is plotted below
0 0.2 0.4 0.6 0.8 1
0 0.2 0.4 0.6 0.8 1
ω/π
Magnitude
α = 0.8 α = 0.5 α = 0.2
0 0.2 0.4 0.6 0.8 1
0 0.2 0.4 0.6 0.8 1
ω/π
Magnitude
β = 0.8 β = 0.5 β = 0.2
Simple IIR Digital Filters Simple IIR Digital Filters
• Here, the magnitude function takes the maximum value of1 atω= 0 andω= π
• It goes to0 at , where , called the notch frequency, is given by
• The digital transfer function is more commonly called anotch filter
ωo
=
ω ωo
) ( cos1β
= ωo −
) (z HBS
Simple IIR Digital Filters Simple IIR Digital Filters
• The frequencies and where becomes1/2 are called the3-dB cutoff frequencies
• The difference between the two cutoff frequencies, assuming is called the3-dB notch bandwidthand is given by
|2
) (
|HBS ejω
1
ωc ωc2
1
2 c
c >ω ω
1 1 2−ω =cos− ω
= c c
Bw ⎟
⎠
⎜ ⎞
⎝
⎛ α +
α 1 2
2
49
Copyright © 2005, S. K. Mitra
Simple IIR Digital Filters Simple IIR Digital Filters
Higher-Order IIR Digital Filters
• By cascading the simple digital filters discussed so far, we can implement digital filters with sharper magnitude responses
• Consider a cascade ofKfirst-order lowpass sections characterized by the transfer function
⎟⎟⎠
⎞
⎜⎜⎝
⎛ α
− + α
= − −−
1 1
1 1 2 ) 1 (
z z z
HLP
50
Copyright © 2005, S. K. Mitra
Simple IIR Digital Filters Simple IIR Digital Filters
• The overall structure has a transfer function given by
• The corresponding squared-magnitude function is given by
K
LP z
z z
G ⎟⎟
⎠
⎜⎜ ⎞
⎝
⎛
α
−
⋅ + α
= − −−11 1
1 2 ) 1 (
K j
LP e
G ⎥
⎦
⎢ ⎤
⎣
⎡
ω α
− α +
ω + α
= −
ω
) cos 2 1 ( 2
) cos 1 ( ) 1
| ( ) (
| 2
2 2
51
Copyright © 2005, S. K. Mitra
Simple IIR Digital Filters Simple IIR Digital Filters
• To determine the relation between its 3-dB cutoff frequency and the parameterα, we set
which when solved forα, yields for a stable :
ωc
2 1 ) cos 2 1 ( 2
) cos 1 ( ) 1 (
2
2 ⎥ =
⎦
⎢ ⎤
⎣
⎡
ω α
− α +
ω + α
− K
c c
) (z GLP
c c c
C
C C C
ω +
−
− ω
− ω
−
= +
α 1 cos
2 sin cos ) 1 (
1 2
52
Copyright © 2005, S. K. Mitra
Simple IIR Digital Filters Simple IIR Digital Filters
where
• It should be noted that the expression for α given earlier reduces to
forK= 1
K
C=2(K−1)/
c
ωωc
= − α cos
sin 1
53
Copyright © 2005, S. K. Mitra
Simple IIR Digital Filters Simple IIR Digital Filters
• Example -Design a lowpass filter with a 3- dBcutoff frequency at using a single first-order section and a cascade of4 first-order sections, and compare their gain responses
• For the single first-order lowpass filter we have
π
= ωc 0.4
1584 . ) 0 4 . 0 cos(
) 4 . 0 sin(
1 cos
sin
1 =
π π
= + ω
ω
= + α
c c
54
Copyright © 2005, S. K. Mitra
Simple IIR Digital Filters Simple IIR Digital Filters
• For the cascade of4 first-order sections, we substitute K= 4and get
• Next we compute
6818 1 2
2( 1)/ = (4 1)/4= .
= K− K − C
c c c
C
C C C
ω +
−
− ω
− ω
−
= +
α 1 cos
2 sin cos ) 1 (
1 2
) 4 . 0 cos(
6818 . 1 1
) 6818 . 1 ( ) 6818 . 1 ( 2 ) 4 . 0 sin(
) 4 . 0 cos(
) 6818 . 1 1 (
1 2
π +
−
− π
− π
−
= +
0.251
−
=
55
Copyright © 2005, S. K. Mitra
Simple IIR Digital Filters Simple IIR Digital Filters
• The gain responses of the two filters are shown below
• As can be seen, cascading has resulted in a sharper roll-off in the gain response
10-2 10-1 100
-20 -15 -10 -5 0
ω/π
Gain, dB
K=4
K=1 Passband details
10-2 10-1 100
-4 -2 0
ω/π
Gain, dB K=1 K=4