EE 338 Digital
Signal Processing
Filter Design Assignment
Mantri Krishna Sri Ipsit
180070032
Autumn 2020
INDIAN INSTITUTE OF TECHNOLOGY BOMBAY
DEPARTMENT OF ELECTRICAL ENGINEERING
Contents
1 Infinite Impulse Response Bandpass Filter 1
1.1 Unnormalized Specifications . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Normalized Specifications . . . . . . . . . . . . . . . . . . . . . . . . 1
1.3 Analog Filter Specifications using Bilinear Transform . . . . . . . . 2
1.4 Analog Frequency Transformation . . . . . . . . . . . . . . . . . . . 2
1.5 Equivalent Analog Lowpass Filter Specifications . . . . . . . . . . . 3
1.6 Analog Lowpass Magnitude Response . . . . . . . . . . . . . . . . . 3
1.7 Analog Bandpass Transfer Function . . . . . . . . . . . . . . . . . . 7
1.8 DiscreteTime Bandpass Transfer Function . . . . . . . . . . . . . . 8
2 Finite Impulse Response Bandpass Filter 11
2.1 Implementation Technique . . . . . . . . . . . . . . . . . . . . . . . 11
2.2 Kaiser Window Parameters . . . . . . . . . . . . . . . . . . . . . . . 12
2.3 Discrete Time FIR Filter Transfer Function . . . . . . . . . . . . . . 12
2.4 Magnitude and Phase Response . . . . . . . . . . . . . . . . . . . . 13
2.5 Comparison with the IIR Filter . . . . . . . . . . . . . . . . . . . . . 14
3 Infinite Impulse Response Bandstop Filter 15
3.1 Unnormalized Specifications . . . . . . . . . . . . . . . . . . . . . . 15
3.2 Normalized Specifications . . . . . . . . . . . . . . . . . . . . . . . . 15
3.3 Analog Filter Specifications using Bilinear Transform . . . . . . . . 16
3.4 Analog Frequency Transformation . . . . . . . . . . . . . . . . . . . 17
3.5 Equivalent Analog Lowpass Filter Specifications . . . . . . . . . . . 17
3.6 Analog Lowpass Magnitude Response . . . . . . . . . . . . . . . . . 18
3.7 Analog Bandstop Transfer Function . . . . . . . . . . . . . . . . . . 20
3.8 DiscreteTime Bandstop Transfer Function . . . . . . . . . . . . . . 22
4 Finite Impulse Response Bandstop Filter 24
4.1 Implementation Technique . . . . . . . . . . . . . . . . . . . . . . . 24
4.2 Kaiser Window Parameters . . . . . . . . . . . . . . . . . . . . . . . 25
4.3 Discrete Time FIR Filter Transfer Function . . . . . . . . . . . . . . 25
4.4 Magnitude and Phase Response . . . . . . . . . . . . . . . . . . . . 26
4.5 Comparison with the IIR Filter . . . . . . . . . . . . . . . . . . . . . 27
i
5 Peer Review 28
5.1 Review Received . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
5.2 Review Given . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
ii
1 Infinite Impulse Response Bandpass Filter
The filter number m = 44. Hence,
q(m) = ⌊0.1m⌋ = 4
r(m) = m − 10 q(m) = 44 − 40 = 4
BL(m) = 25 + 1.7q(m) + 6.1r(m) = 55.8 kHz
BH(m) = BL(m) + 20 = 75.8 kHz
1.1 Unnormalized Specifications
• Lower Passband Edge = 56.2 kHz
• Upper passband Edge = 76.2 kHz
• Transition band width = 4 kHz
• Passband tolerance = 0.15
• Stopband tolerance = 0.15
• Passband nature = monotonic
• Stopband nature = monotonic
• Sampling frequency = 330 kHz
1.2 Normalized Specifications
The sampling angular frequency 2πfs should map to 2π after normalization.
Hence the transformation used is
fs
ω = 2π
f
The normalized specifications are as follows (following the notations used in the
lecture)
55.8
• ωp1 = 2π 330
= 0.3382 π
75.8
• ωp2 = 2π 330
= 0.4594 π
1
4
• Transition bandwidth = 2π 330
= 0.0242 π
• ωs1 = ωp1 − 0.0242 π = 0.314 π
• ωs2 = ωp2 + 0.0242 π = 0.4836 π
• Passband and Stopband tolerance = 0.15
• Passband and Stopband nature = monotonic
1.3 Analog Filter Specifications using Bilinear Transform
We use the following transformation to move from the z domain to the s
domain.
1 − z −1
s=
1 + z −1
If we put z = jω and s = jΩ, we get
ω
Ω = tan
2
The specifications now are
• Passband and Stopband nature = monotonic
• Ωs1 = 0.5375
• Ωs2 = 0.9498
• Ωp1 = 0.5875
• Ωp2 = 0.8799
• δ1 = δ2 = 0.15
1.4 Analog Frequency Transformation
Here we use the Bandpass to Lowpass analog frequency transformation, which
is as follows:
Ω2 − Ω20
ΩL =
BΩ
where
√
Ω0 = Ωp1 Ωp2 = 0.7189
2
and
B = Ωp2 − Ωp1 = 0.2924
Using the transformation mentioned above, we now have
• Passband and Stopband nature = monotonic
• ΩLs1 = −1.4501
• ΩLs2 = 1.3874
• ΩLp1 = −1
• ΩLp2 = +1
• δ1 = δ2 = 0.15
1.5 Equivalent Analog Lowpass Filter Specifications
Using the more stringent specifications from those obtained in section 1.4, we
have
• Passband and Stopband nature = monotonic
• ΩLs = min{ΩLs2 , |ΩLs1 |} = 1.3874
• ΩLp = +1
• δ1 = δ2 = 0.15
• D1 = 1
(1−δ1 )2
− 1 = 0.384
• D2 = 1
δ22
− 1 = 43.44
1.6 Analog Lowpass Magnitude Response
Since we have to make a Butterworth filter, the general response is given as
1
HLP F (sL ) HLP F (−sL ) = ( )
sL 2N
1+ j Ωc
3
The parameters N and Ωc can be found as follows:
√
⌈ ⌉
log( D2 /D1 )
N=
log(ΩLs /ΩLp )
and
ΩLp ΩLs
1 ≤ Ωc ≤ 1
D1 2N
D22N
Using the above relations, we get
N =8
1.0616 ≤ Ωc ≤ 1.096
We choose Ωc = 1.0788. Using these values, we have
1
HLP F (sL ) HLP F (−sL ) = ( sL
)16
1+ j 1.0788
After using MATLAB to find and plot the poles, we have
Figure 1.1: Poles of the equivalent lowpass filter
To have a realisable filter, we choose only those poles which lie on the left half of
the complex sL plane, which are as follows:
4
Pole Value
s1 −0.5993 + j 0.8970
s2 −0.8970 + j 0.5993
s3 −1.0581 + j 0.2105
s4 −1.0581 − j 0.2105
s5 −0.8970 − j 0.5993
s6 −0.5993 − j 0.8970
s7 −0.2105 − j 1.0581
s8 −0.2105 + j 1.0581
Table 1.1: Poles on left half plane
Using the poles determined in table 1.1, the equivalent analog lowpass
transfer function is given by
ΩN
c 1.8345
HLP F (sL ) = =
∏
N ∑
8
(sL − sk ) ak skL
k=1 k=0
where the coefficients of the denominator are
Coefficient Value
a0 1.8345
a1 8.7167
a2 20.708
a3 31.921
a4 34.794
a5 27.428
a6 15.289
a7 5.5297
a8 1
Table 1.2: Coefficients of Denominator
The magnitude and the phase responses of this equivalent Butterworth LPF are
as follows:
5
Figure 1.2: Magnitude Response
Figure 1.3: Phase Response
6
1.7 Analog Bandpass Transfer Function
We now use the inverse transformation to convert the equivalent Butterworth
lowpass transfer function to get the Bandpass transfer function using the
relation:
s2 + Ω20
sL ←−
Bs
where B and Ω0 have the values as we found in section 1.4
( )
s2 + Ω20 1.8345
HLP F = HBP F (s) =
Bs ∑
8
168879.9214 + ak s k
k=−8
The coefficients ak are as follows:
Coefficient Value
a1 182483.5084
a−1 94310.6177
a2 252765.02515
a−2 67513.5454
a3 204166.44531
a−3 28183.5223
a4 220581.2811
a−4 15736.8035
a5 122303.3771
a−5 4509.4469
a6 101839.6751
a−6 1940.6124
a7 30259.6314
a−7 298.0042
a8 18714.6217
a−8 95.2525
Table 1.3: Coefficients of Denominator in the Analog BP transfer function
The magnitude and frequency response are as follows:
Please see the next page
7
Figure 1.4: Magnitude response of the analog BPF
+
Figure 1.5: Phase response of the analog BPF
1.8 DiscreteTime Bandpass Transfer Function
We now make use of the Bilinear Transformation to convert the analog bandpass
filter into a discrete bandpass filter in the normalized angular frequency domain.
The transform is as follows:
1 − z −1
s ←−
1 + z −1
The discrete time filter transfer function is
∑
16
( −1
) bk z k
1−z k=0
HBP F = H(z) =
1 + z −1 ∑16
ak z k
k=0
8
with coefficients
Coefficient Value Coefficient Value
a16 0.0083 b16 1
a15 −0.0366 b15 0
a14 0.1197 b14 −8
a13 −0.2688 b13 0
a12 0.5003 b12 28
a11 −0.7489 b11 0
a10 0.9662 b10 −56
a9 −1.0495 b9 0
a8 0.9966 b8 70
a7 −0.8059 b7 0
a6 0.5697 b6 −56
a5 −0.3389 b5 0
a4 0.1737 b4 28
a3 −0.0715 b3 0
a2 0.0244 b2 −8
a1 −0.0057 b1 0
a0 0.0010 b0 1
Table 1.4: Denominator (×108 ) Table 1.5: Numerator
Please see the next page
9
Figure 1.6: Magnitude Response of Discrete Time Bandpass Filter
Figure 1.7: Phase Response of Discrete Time Bandpass Filter
10
2 Finite Impulse Response Bandpass Filter
In this part, we will use the windowing method to design a finite impulse
response bandpass filter for the filter 44 using the same specifications as above.
Recalling the specifications from section 1.2, we have the following normalized
specifications:
55.8
• ωp1 = 2π 330
= 0.3382 π
75.8
• ωp2 = 2π 330
= 0.4594 π
4
• Transition bandwidth(∆ωT ) = 2π 330
= 0.0242 π
• ωs1 = ωp1 − 0.0242 π = 0.314 π
• ωs2 = ωp2 + 0.0242 π = 0.4836 π
• Passband and Stopband tolerance(δ) = 0.15
We will use a timeshifted Kaiser Window and multiply it with the impulse
response of an ideal bandpass filter to get a realizable FIR filter.
2.1 Implementation Technique
While calculating the ideal bandpass filter response, the mean of the lower
passband and stopband edges are used as one of the lower passband edge and
the mean of the upper passband and stopband edges are used to find the upper
passband edge. The same is mentioned in the following figure:
0 ωs1 ωp1 ωp2 ωs2 π
Figure 2.1: Ideal Bandpass Filter Magnitude Response
11
2.2 Kaiser Window Parameters
We have
A = −20 log10 (δ) = 16.478
As A < 21, the shape parameter β = 0 and the Kaiser window in this case is
essentially a rectangular window. Also, the window width M is
⌈ ⌉
A−8
M ≥ 1+ = 50
2.285 ∆ωT
After tuning by hit and trail method so that the maximum error is within the
tolerance, it has been found that a window width of M = 66 satisfies all the
required specifications.
2.3 Discrete Time FIR Filter Transfer Function
The transfer function of the FIR filter obtained after adjusting for causality is as
shown below. These are the coefficients of the Z transform of the impulse response
of the FIR filter.
Figure 2.2: Bandpass FIR Transfer Function
12
Figure 2.3: Bandpass FIR Impulse Response
2.4 Magnitude and Phase Response
Figure 2.4: Magnitude Response of the FIR filter
13
Figure 2.5: Phase Response of the FIR filter
2.5 Comparison with the IIR Filter
We can see that on comparing figure 1.7 and figure 2.5, we can see that the FIR
filter gives a linear phase response for the frequencies in the passband range i.e
from 55.8kHz to 75.8kHz.
Also, we can observe that the order of the IIR filter is 8 and the order of the
FIR filter is 66 which is much higher. This once again proves the fact that there
is no free lunch, i.e., we are getting a linear phase response at the expense of
resources.
14
3 Infinite Impulse Response Bandstop Filter
The filter number m = 44. Hence,
q(m) = ⌊0.1m⌋ = 4
r(m) = m − 10 q(m) = 44 − 40 = 4
BL(m) = 25 + 1.9q(m) + 4.1r(m) = 49 kHz
BH(m) = BL(m) + 20 = 69 kHz
3.1 Unnormalized Specifications
• Lower Passband Edge = 45 kHz
• Upper passband Edge = 73 kHz
• Transition band width = 4 kHz
• Lower Stopband Edge = 49 kHz
• Upper Stopband Edge = 69 kHz
• Passband tolerance = 0.15
• Stopband tolerance = 0.15
• Passband nature = equiripple
• Stopband nature = monotonic
• Sampling frequency = 260 kHz
3.2 Normalized Specifications
The sampling angular frequency 2πfs should map to 2π after normalization.
Hence the transformation used is
fs
ω = 2π
f
The normalized specifications are as follows (following the notations used in the
lecture)
15
45
• ωp1 = 2π 260
= 0.3461 π
73
• ωp2 = 2π 260
= 0.5615 π
49
• ωs1 = 2π 260
= 0.3769 π
69
• ωs2 = 2π 260
= 0.5307 π
4
• Transition bandwidth = 2π 260
= 0.0308 π
• Passband and Stopband tolerance = 0.15
• Passband nature = equiripple
• Stopband nature = monotonic
3.3 Analog Filter Specifications using Bilinear Transform
We use the following transformation to move from the z domain to the s
domain.
1 − z −1
s=
1 + z −1
If we put z = jω and s = jΩ, we get
ω
Ω = tan
2
The specifications now are
• Passband nature = equiripple
• Stopband nature = monotonic
• Ωs1 = 0.6725
• Ωs2 = 1.1014
• Ωp1 = 0.6044
• Ωp2 = 1.2146
• δ1 = δ2 = 0.15
16
3.4 Analog Frequency Transformation
Here we use the Bandstop to Lowpass analog frequency transformation, which
is as follows:
BΩ
ΩL =
− Ω2
Ω20
where
√
Ω0 = Ωp1 Ωp2 = 0.8568
and
B = Ωp2 − Ωp1 = 0.6102
Using the transformation mentioned above, we now have
• Passband and Stopband nature = monotonic
• ΩLs1 = 1.456
• ΩLs2 = −1.4031
• ΩLp1 = +1
• ΩLp2 = −1
• δ1 = δ2 = 0.15
3.5 Equivalent Analog Lowpass Filter Specifications
Using the more stringent specifications from those obtained in section 3.4, we
have
• Passband nature = equiripple
• Stopband nature = passband
• ΩLs = min{|ΩLs2 |, |ΩLs1 |} = 1.4031
• ΩLp = +1
• δ1 = δ2 = 0.15
• D1 = 1
(1−δ1 )2
− 1 = 0.384
• D2 = 1
δ22
− 1 = 43.44
17
3.6 Analog Lowpass Magnitude Response
Since we have to make a Chebyshev filter, the general response is given as
1
HLP F (sL ) HLP F (−sL ) =
1+ ϵ2 CN2 (sL /j ΩLp )
Where the parameters ϵ and N are given by
√
ϵ= D1 = 0.6197
and ⌈ √ ⌉
cosh−1 ( D2 /D1 )
N= =4
cosh−1 (ΩLs /ΩLp )
After using MATLAB to find and plot the poles, we have
Figure 3.1: Poles of the equivalent lowpass filter
To have a realisable filter, we choose only those poles which lie on the left half of
18
the complex sL plane, which are as follows:
Pole Value
s1 −0.1222 + j 0.9698
s2 −0.2949 + j 0.4017
s3 −0.2949 − j 0.4017
s4 −0.1222 − j 0.9698
Table 3.1: Poles on left half plane
Using the poles determined in table 3.1, the equivalent analog lowpass
transfer function is given by
A
HLP F (sL ) =
∏
N
(sL − sk )
k=1
Substituting the constraint that the value of the magnitude response at the
passband edge is 1 − δ1 , we have
∏
4
si
0.2373
HLP F (sL ) = (i=1N )=
√ ∏ 1.1764 sL + 0.9814 sL + 1.5858 s2L + 0.7345 sL + 0.2792
4 3
1 + D1 (sL − sk )
k=1
Figure 3.2: Magnitude Response
19
Figure 3.3: Phase Response
3.7 Analog Bandstop Transfer Function
We now use the inverse transformation to convert the equivalent Chebyshev
lowpass transfer function to get the Bandstop transfer function using the
relation:
Bs
sL ←−
s2 + Ω20
where B and Ω0 have the values as we found in section 3.4
( )
Bs 1.3516 s8 + 3.9691 s6 + 4.3707 s4 + 2.1390 s2 + 3.9257
HLP F = HBSF (s) =
s + Ω20
2 ∑8
4.6183 + bk s k
k=1
Coefficient Value
b8 1.5902
b7 2.5527
b6 8.0327
b5 6.8921
b4 1.1001
b3 5.0595
b2 4.3289
b1 1.0099
Table 3.2: Denominator
20
The magnitude and frequency response are as follows:
Figure 3.4: Magnitude Response of Chebyshev Bandstop filter
Figure 3.5: Phase Response of Chebyshev Bandstop filter
21
3.8 DiscreteTime Bandstop Transfer Function
We now make use of the Bilinear Transformation to convert the analog bandstop
filter into a discrete bandstop filter in the normalized angular frequency domain.
The transform is as follows:
1 − z −1
s ←−
1 + z −1
The discrete time filter transfer function is
∑
8
( −1
) bk z k
1−z k=0
HBSF = H(z) =
1 + z −1 ∑8
ak z k
k=0
Coefficient Value Coefficient Value
a8 4.0936 b8 1.2223
a7 −3.6764 b7 −1.4993
a6 8.8842 b6 5.5789
a5 −5.8977 b5 −4.6390
a4 8.6077 b4 8.7240
a3 −3.7768 b3 −4.6390
a2 3.6893 b2 5.5789
a1 −1.0919 b1 −1.4993
a0 9.9081 b0 1.2223
Table 3.3: Denominator Table 3.4: Numerator
Please see the next page
22
Figure 3.6: Magnitude Response of Discrete Time Bandstop Filter
Figure 3.7: Phase Response of Discrete Time Bandstop Filter
23
4 Finite Impulse Response Bandstop Filter
In this part, we will use the windowing method to design a finite impulse
response bandstop filter for the filter 44 using the same specifications as above.
Recalling the specifications from section 3.2, we have the following normalized
specifications:
45
• ωp1 = 2π 260
= 0.3461 π
73
• ωp2 = 2π 260
= 0.5615 π
49
• ωs1 = 2π 260
= 0.3769 π
69
• ωs2 = 2π 260
= 0.5307 π
4
• Transition bandwidth(∆ωT ) = 2π 260
= 0.0308 π
• Passband and Stopband tolerance = 0.15
We will use a timeshifted Kaiser Window and multiply it with the impulse
response of an ideal bandstop filter to get a realizable FIR filter.
4.1 Implementation Technique
While calculating the ideal bandstop filter response, the mean of the lower
passband and stopband edges are used as one of the lower stopband edge and
the mean of the upper passband and stopband edges are used to find the upper
stopband edge. The same is mentioned in the following figure:
0 ωp1 ωs1 ωs2 ωp2 π
Figure 4.1: Ideal Bandstop Filter Magnitude Response
24
4.2 Kaiser Window Parameters
We have
A = −20 log10 (δ) = 16.478
As A < 21, the shape parameter β = 0 and the Kaiser window in this case is
essentially a rectangular window. Also, the window width M is
⌈ ⌉
A−8
M ≥ 1+ = 40
2.285 ∆ωT
After tuning by hit and trail method so that the maximum error is within the
tolerance, it has been found that a window width of M = 53 satisfies all the
required specifications.
4.3 Discrete Time FIR Filter Transfer Function
The transfer function of the FIR filter obtained after adjusting for causality is as
shown below. These are the coefficients of the Z transform of the impulse response
of the FIR filter.
Figure 4.2: Bandstop FIR Transfer Function
25
Figure 4.3: Bandstop FIR Impulse Response
4.4 Magnitude and Phase Response
Figure 4.4: Magnitude Response of the FIR filter
26
Figure 4.5: Phase Response of the FIR filter
4.5 Comparison with the IIR Filter
We can see that on comparing figure 3.7 and figure 4.5, we can see that the FIR
filter gives a linear phase response for the frequencies in the passband range.
Also, we can observe that the order of the IIR filter is 4 and the order of the
FIR filter is 53 which is much higher. This once again proves the fact that there
is no free lunch, i.e., we are getting a linear phase response at the expense of
resources.
27
5 Peer Review
5.1 Review Received
Review by :Shlok Vaibhav Singh, 18D070064, Group 1
I have reviewed this report made by Mantri Krishna Sri Ipsit, I certify that he has
completed all the steps for the design of a bandpass and a bandstop filter using
IIR, FIR and elliptic filter design methods.
5.2 Review Given
Review given to: Amol Girish Shah, 18D070005, Group 1
I have reviewed the report made by Amol Girish Shah and I certified that he has
completed all the steps for the design of a bandpass and a bandstop filter using
IIR, FIR and elliptic filter design methods.
28