chapter10 sm
TRANSCRIPT
8/12/2019 Chapter10 SM
http://slidepdf.com/reader/full/chapter10-sm 1/64
8/12/2019 Chapter10 SM
http://slidepdf.com/reader/full/chapter10-sm 2/64
( ) ( ) ( )
( ) ( )[ ] 4424.14278.00411.0log5941.00411.0log00266.0
0137.0log4761.00411.0log07114.00411.0log005309.0,
10
2
10
1010
2
10
=++
−⋅−+=∞ s p D δ δ
[ ] 256666.110137.0log0411.0log51244.001217.11, 1010 =−+= s p F δ δ
]
12248.112 / 345.0575.0
2 / 345.0575.0256666.114424.1 2
≈ = π π π
π π π N
10.2 and75= N π ω ω 05.0=− p s and we assume . p s δ δ =
(a) Using Kaiser’s formula of Eq. (10.3):
[ ]
375.40009577.010 20
132 / 05.06.1475
=⎟⎠
⎞⎜⎝
⎛
ss αδ
π π
dB.
(b) Using Bellanger’s formula of Eq. (10.4):
5.380119.0101.0
2 / 1
2
2 / 05.0376
=⎟⎟
⎟
⎠
⎞
⎜⎜
⎜
⎝
⎛
⋅⎟⎠
⎞⎜⎝
⎛ ⋅
ss αδ
π π
dB.
(c) Using Hermann’s formula of Eq. (10.5):
( ) ( ) ( )[ ]2
11 2/2/ π ω ω π ω ω δ p s p s s b N Db F −+−=∴= ∞
( ) ( ) ( ) ( )
( ) ( )[ ]( ) ( ) ( ) ( )
( ) ( )
( ) ( ) ( )( ) ( )( ) 61053
2
1042
3
101
6105
2
104
103
2
102
3
101
6105
2
104
103102
2
101
logloglog
loglog
logloglog
loglog
logloglog
aaaaaa D
aaa
aaa D
aaa
aaa D
s s s s
s s
s s s s
s s
s s s s
−−+−+=
−−
−++=
++
−++=
∞
∞
∞
δ δ δ δ
δ δ
δ δ δ δ
δ δ
δ δ δ δ
Let ( s x )δ 10log= , and thus
( ) 875697.14278.00702.106848.0005309.0 23 =−−+=∞ x x x D sδ
Solving for x gives us three possible solutions:4263.10,94654.1,3787.21 =−=−= x x x
The most reasonable solution is the second. Therefore,
93.380113.0 =∴= s s α δ
10.3 and75= N ω π ω ω ∆==− 05.0 p s
( ) 9.348285.2 =+∆=
N sα dB.
10.4 The ideal L -band digital filter )( z H ML has a frequency response given by
for,)( k j
ML Ae H =ω ,1 k k ωωω ≤ ,1 Lk ≤ and can be considered as sum of L ideal
bandpass filters with cutoff frequencies at and where
and Now from Eq. (10.47) the impulse response of an ideal bandpass filter is
11 k k c ωω ,2 k
k c ωω = 00
1 =cω
.2 π Lc
ω
Not for sale 325
8/12/2019 Chapter10 SM
http://slidepdf.com/reader/full/chapter10-sm 3/64
given by .)sin()sin(
][ 12
n
n
n
nnh cc
BPπ
ω
π
ω Therefore ,
n
n
n
nnh k k k
BPπ
ω
π
ω )sin()sin(][ 1 . Hence,
∑=
=⎟⎠⎞⎜
⎝⎛
L
k
k k k
L
k
k BP MLn
nn
n Anhnh
1
1
1
)sin()sin(][][π ω
π ω
∑
=
=
⎟⎠
⎞⎜⎝
⎛
⎠
⎞⎜⎝
⎛
1
2
11
2
11
)sin()sin()sin()0sin()sin( L
k
k k k
L
k
k k
n
n
n
n A
n
n A
n
n
n
n A
π
ω
π
ω
π
ω
π π
ω
⎟⎠
⎞⎜⎝
⎛
n
n
n
n A L L
Lπ
ω
π
ω )sin()sin( 1
n
n A
n
n A
n
n A
n
n A L
L
L
k
L
k
k k
k k
π
ω
π
ω
π
ω
π
ω )sin()sin()sin()sin( 11
2
1
2
111
=
=
∑ ∑
.)sin()sin(1
1 2
1∑ ∑= =
L
k
L
k
k k
k k
n
n A
n
n A
π
ω
π
ω
Since , Lω .0)sin( =n Lω We add a termn
n A L
Lπ
ω )sin( to the first sum in the above
expression and change the index range of the second sum, resulting in
.)sin()sin(
][
1
1
11∑
=
=
L
k
L
k
k k
k k ML
n
n A
n
n Anh
π
ω
π
ω
Finally, since ,01 = L A we can add a term
n
n A L
L
π
ω )sin(1 to the second sum. This leads to
.)sin(
)()sin()sin(
][
1 1 111∑ ∑
= = =
L
k
L
k
L
k
k k k
k k
k k ML
n
n A A
n
n A
n
n Anh
π
ω
π
ω
π
ω
10.5 Therefore,⎩ <
<=
.0,
,0,)(
π ω
ωπ ω
j
je H j
HT
∫π
ππ
0
0
)(2
1)(
2
1][ ωω ωω
π
ωω d ee H d ee H nh n j j HT
n j j HT HT
n
nnn
d jed je n jn j
π
π π π
ωω ω
π
ω )2 / (sin2)cos(12
221
21 2
0
0
=ππ ∫
π
if .0n
For ,0n .02
1
2
1]0[
0
0
=ππ ∫
π
ωω
π
jd jd h HT
Not for sale 326
8/12/2019 Chapter10 SM
http://slidepdf.com/reader/full/chapter10-sm 4/64
Hence,⎪⎩
⎪⎨
⎧
≠π
π
=
=.,
)/(
,,
][0if
22sin
0if 02
nn
n
n
nh HT
Since ],[][ nhnh HT HT and the length of the truncated impulse response is odd, it is a Ty
3 linear-phase FIR filter.
0 0.2 0.4 0.6 0.8 10
0.2
0.4
0.6
0.8
1
ω / π
M a g n i t u d e
N=11
N=21
N=61
From the frequency response plots given above, we observe the presence of ripples at the bandedges due to the Gibbs phenomenon caused by the truncation of the impulse response.
10.6 . Hence,∑ ∞
k
HT k x k nhn x ][][]}[{H
{ }} )()(][ ωω j j HT e X e H n x =H F
⎪
⎪⎨⎧
<
<=
.0),(
,0),(
π ω
ωπ ω
ω
j
j
e jX
e jX
(a) Let { }}}.][ ][n x n y H H H H } Hence,
Therefore,
(
,0),()(–
,0),()(
4
4ω
ω
ωω
π ω
ωπ j j
j j e X
e X j
e X jeY =
⎪
⎪⎨⎧
<
<=
].[][ n x n y =
(b) Define and,][][ n x ng H } ].[][* n x nh = Then
But from the Parseval's' relation in Table 3.4,
{ } [*][][][–– ∑
∞
∞
∞
∞=
ll llll hg x x H
.)()(2
1][*][
–– ωωω d eGeGhg j j∫ π
∞
∞ πl ll
π
Therefore, { } ωωωω
d e X e X e H x x j j j
HT )()()(2
1][][ –
– ∫ π
∞
∞ πl llH
π where
Since the integrand
⎩ <
<=
.0,
,0,)(
π ω
ωπ ω
j
je H j
HT )()()( – ωωω j j j
HT e X e X e H is an odd
function of As a result, ,ω .0)()()( – =∫π
πω
ωωωd e X e X e H j j j
HT { } .0][][–
=∞
∞l ll x x H
Not for sale 327
8/12/2019 Chapter10 SM
http://slidepdf.com/reader/full/chapter10-sm 5/64
8/12/2019 Chapter10 SM
http://slidepdf.com/reader/full/chapter10-sm 6/64
For ,0n .02
1]0[ =
π ∫
π
π
ωωd jh DIF
Hence,
⎪
⎪⎨⎧
>
==
.0||,
)cos(,0,0
][
nn
nn
nh DIF Since ],[][ nhnh DIF DIF the truncated impulse
response is a Type 3 linear-phase FIR filter. The magnitude responses of the abovedifferentiator for several values of M are given below:
0 0.2 0.4 0.6 0.8 10
1
2
3
4
ω / π
M a g n i t u d e
M=10
M=20
M=30
10.9 .12 M N
⎪⎪⎪
⎩
⎪
⎪
⎨
⎧
<
=
=
otherwise.0,
if
for
,0,,)(
)(sin
,,1
][ˆ N n M nmn
mn
M n
nh c
c
HPπ
ωπ
ω
Now,==
∞
∞
1
0
1
0][ˆ][ˆ][ˆ][ˆ)(ˆ)(ˆ
N
n
LP
N
n
n HP
n
n LP
n
n HP LP HP znh znh znh znh z H z H
.][ˆ][ˆ
1
0∑=
N
n
n LP HP znhnh
But ][ˆ][ˆ nhnh LP HP = ,⎩
≠=
.
1,0][ˆ][ˆ
n=M
M , n N– nnhnh LP HP
1,
,0
Hence, ,)(ˆ)(ˆ – M LP HP z z H z H = i.e. the two filters are delay-complementary.
10.10 ⎩
<= otherwise.,0
,,)( c j LLP e H ωωωω Therefore,
Not for sale 329
8/12/2019 Chapter10 SM
http://slidepdf.com/reader/full/chapter10-sm 7/64
8/12/2019 Chapter10 SM
http://slidepdf.com/reader/full/chapter10-sm 8/64
0 0.2 0.4 0.6 0.8 10
0.5
1
1.5
/
A m p l i t u d e
o = 0.4š
10.13
π
π
ωωω
π
d e H e H jd
jt R
2
2
1Φ , where [ ] .∑
=
M
M n
n jt
jt enhe H
ωω
Using Parseval’s relation, we can write [ ] [ ]∑∞
∞
n
d t R nhnh2
Φ
[ ] [ ] [ ] [ ]∑ ∑
∞
∞
M
M n M n
d
M
n
d d t nhnhnhnh
1
2122
.
Now, [ ] [ ] [ ]∑∞
∞
n
d Hannd Haan nhnwnh2
Φ
[ ] [ ] [ ] [ ]∑∞
∞
⎟⎠
⎞⎜⎝
⎛⎟⎠
⎞⎜⎝
⎛
1
212
2
12
2cos
2
1
2
1
M n
d
M
n
d
M
M n
d d nhnhnh M
nnh
π
Hence, Haan R Excess
ΦΦΦ
[ ] [ ] [ ] [ ] [ ]∑
⎟⎠
⎞⎜⎝
⎛⎟⎠
⎞⎜⎝
⎛
M
M n
d d
M
M n
d Rd nh M
nnhnhnwnh
22
12
2cos
2
1
2
1 π
[ ] [ ]∑ ⎠
⎞⎜⎝
⎛
M
M n
d d nh
M
nnh2
212
2cos
2
π
2
112
2cos21
2
1
⎠
⎞⎜⎝
⎛
M
M M
π
.
10.14 [ ] [ ]∑∞
−∞=
−=Φn
d t R nhnh
2and [ ] [ ] [ ] .
2∑∞
∞
n
d Hammd Hamm nhnwnhΦ
Therefore, Hamm R Excess ΦΦΦ [ ]∑
⎟⎠
⎞⎜⎝
⎛
⎠
⎞⎜⎝
⎛
M
M n
d M
nnh
2
46.012
2cos46.0 π
[ ]∑
⎟⎠
⎞⎜⎝
⎛
⎠
⎞⎜⎝
⎛
M
M n
d M
nnh
2
112
2cos46.0
π
.112
2cos1246.0
2
⎠
⎞⎜⎝
⎛
M
M M
π
Not for sale 331
8/12/2019 Chapter10 SM
http://slidepdf.com/reader/full/chapter10-sm 9/64
10.15 (a) π ω 47.0= p , π 59.0= s , 001.0= pδ , 007.0= sδ , π 12.0=∆ ,
1.43log20 10 =−= s s δ α dB
From Table 10.2, we see that for fixed-window functions, we can achieve the minimum
stopband attenuation by using Hann, Hamming, or Blackman windows. Hann will havethe lowest filter length.
5312 = M N Haan since .917.2512.0
11.3=
π
π M
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1-140
-120
-100
-80
-60
-40
-20
0
20
ω / π
M a g n i t u d e R e s
p o n s e
Lowpass filter using Hann window
(b) π ω 61.0= p , π 78.0= s , 001.0= pδ , 002.0= sδ , π 17.0=∆ ,
54log20 10 =−= s s δ α dB
From Table 10.2, we see that for fixed-window functions, we can achieve the minimumstopband attenuation by using either Hamming, or Blackman windows. Hamming will
have the lowest filter length.
4112 = M N Hamm since 53.1917.0
32.3==
π
π M .
Not for sale 332
8/12/2019 Chapter10 SM
http://slidepdf.com/reader/full/chapter10-sm 10/64
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1-100
-80
-60
-40
-20
0
20
ω / π
M a g n i t u d e R e s p o n s e
Lowpass filter using Hamming window
10.16 π ω 45.01 = p , π ω 65.02 = p , π 3.01 = s , π 8.02 = s , π 15.021 =∆=∆ ,
01.0= pδ , 008.01 = sδ , 05.02 = sδ
42log20 1101 =−= s s δ α dB, 26log20 2102 =−= s s δ α dB
From Table 10.2, we see that the Hann window will have minimum length and meet the
minimum stopband attenuation.
.2115.0
11.3=π
π M Therefore, 43 N .
Not for sale 333
8/12/2019 Chapter10 SM
http://slidepdf.com/reader/full/chapter10-sm 11/64
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1-140
-120
-100
-80
-60
-40
-20
0
20
ω / π
M a g n i t u d e R e s p o n s e
Bandpass filter using Hann window
10.17 π ω 3.01 = p , π ω 8.02 = p , π 45.01 = s , π 65.02 = s , π 15.021 =∆=∆ ,
05.01 = pδ , 009.02 = pδ , 02.0= sδ ,
34log20 10 =−= s s δ α dB
From Table 10.2, we see that the Hann window will have minimum length and meet the
minimum stopband attenuation.
Not for sale 334
8/12/2019 Chapter10 SM
http://slidepdf.com/reader/full/chapter10-sm 12/64
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1-120
-100
-80
-60
-40
-20
0
20
ω / π
M a g n i t u d e R e s p o n s e
Bandstop filter using Hann window
10.18 Consider another filter with a frequency response given by)( ω jeG
⎪⎪⎪
⎩
⎪⎪⎪
⎨
⎧
⎟⎠
⎞⎜⎝
⎛
≤⎟⎠
⎞
⎜⎝
⎛
≤
=
elsewhere.,0
,,)(
sin2
,,
)(
sin2
,0,0
)(
ps p
s p
p
p
jeG
ωωωω
ωωπ
ω
π
ωωωω
ωωπ
ω
π
ωω
ω
∆∆
∆∆
Clearly .)(
)(ω
ωω
d
edH eG
j j = Now,
∫ =
π
π
ωω ωπ
d eeGng n j j )(2
1][
⎜
⎜⎜⎜
⎝
⎛
= ∫⎟⎠
⎞
⎜⎝
⎛
⎟⎠
⎞
⎜⎝
⎛ s
p
s
p
d eed ee
j
n j
p j
n j
p j ω
ω
ωω
ωωπ ω
ω
ωω
ωωπ
ωω
ωπ
π ∆∆
∆
)()(
8
∫
⎟⎠
⎞
⎜⎝
⎛
⎟⎠
⎞
⎜⎝
⎛ p
s
p
s
d eed ee n j
p j
n j
p j ω
ω
ωω
ωωπ ω
ω
ωω
ωωπ
ωω ∆∆
)()(
Not for sale 335
8/12/2019 Chapter10 SM
http://slidepdf.com/reader/full/chapter10-sm 13/64
⎜
⎜⎜⎜
⎝
⎛
⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢
⎣
⎡
⎟⎠
⎞⎜⎝
⎛ ⎥
⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢
⎣
⎡
⎟⎠
⎞⎜⎝
⎛
=
⎟⎠
⎞⎜⎝
⎛
⎠
⎞⎜⎝
⎛
⎠
⎞⎜⎝
⎛
⎠
⎞⎜⎝
⎛
ω
π
ω
π ω
ω
π ω
ω
π ω
ω
πωω
π ω
ω
π ω
ω
πω
∆∆
∆
∆∆
∆
∆∆
∆
n j
eee
n j
eee
j
n jn j jn jn j j ps p ps p )
8
1
⎟
⎟⎟⎟
⎠
⎞
⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢
⎣
⎡
⎟⎠
⎞⎜⎝
⎛ ⎥
⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢
⎣
⎡
⎟⎠
⎞⎜⎝
⎛
⎟⎠⎞⎜
⎝⎛
⎠⎞⎜
⎝⎛
⎠⎞⎜
⎝⎛
⎠⎞⎜
⎝⎛
ω
π
ω
π
ω
π ω
ω
π ω
ω
πωω
π ω
ω
π ω
ω
πω
∆∆
∆∆
∆
∆∆
∆
n j
eee
n j
eee
n jn j jn jn j j s p ps p p
⎟⎟⎟⎟
⎠
⎞
⎜⎜⎜⎜
⎝
⎛
⎟⎠
⎞⎜⎝
⎛ ⎟
⎠
⎞⎜⎝
⎛
=
ω
π
ωω
ω
π
ωω
ω
∆∆
∆n
nn
n
nn
j
ps ps )sin()sin()sin()sin(
4
1
⎜
⎜⎜⎜
⎝
⎛
=
2
22
/ 2
4
)sin()sin(
ω
π
ωπ
ω
ωω
∆
∆
∆n
j
nn ps
.) / (1
1)2 / cos()sin(22 ⎟
⎠
⎞⎜⎝
⎛
=
n j
nnc
π ωπ ω
ωω
∆∆
∆
Now, ].[][ ngn
jnh = Therefore, .
)sin(
) / (1
)2 / cos(][
22 ⎟
⎠
⎞⎜⎝
⎛⎟⎠
⎞
⎜⎝
⎛
=
n
n
n
nnh c
π
ω
π ω
ω
∆
∆
10.19 ][12
4cos
12
2cos][ nw
M
n
M
nnw RGC ⎥
⎦
⎤⎢⎣
⎡⎟⎠
⎞⎜⎝
⎛
⎠
⎞⎜⎝
⎛
π γ
π β α
][22 12
4
12
4
12
2
12
2
nweeee R M
n j
M
n j
M
n j
M
n j
⎥⎥⎥
⎦
⎤
⎢⎢⎢
⎣
⎡
⎟⎟
⎟
⎠
⎞
⎜⎜
⎜
⎝
⎛
⎟⎟
⎟
⎠
⎞
⎜⎜
⎜
⎝
⎛
⎟
⎠
⎞⎜
⎝
⎛
⎠
⎞⎜
⎝
⎛
⎠
⎞⎜
⎝
⎛
⎠
⎞⎜
⎝
⎛
π π π π
γ β α
Hence,⎟⎟⎟
⎠
⎞
⎜⎜⎜
⎝
⎛
⎟⎟⎟
⎠
⎞
⎜⎜⎜
⎝
⎛
⎟⎠
⎞⎜⎝
⎛
⎠
⎞⎜⎝
⎛
12
2
12
2
22)()( M j
R M
j
R j
R j
GC eeee
π ω
π ω
ωω β β α ΨΨΨΨ
.22 12
4
12
4
⎟⎟⎟
⎠
⎞
⎜⎜⎜
⎝
⎛
⎟⎟⎟
⎠
⎞
⎜⎜⎜
⎝
⎛
⎟⎠
⎞⎜⎝
⎛
⎠
⎞⎜⎝
⎛
M j
R M
j
R ee
π ω
π ω
γγ ΨΨ
For the Hann window : = 0.5, = 0.5 and = 0. Hence,
⎟⎟⎟
⎠
⎞
⎜⎜⎜
⎝
⎛
⎟⎟⎟
⎠
⎞
⎜⎜⎜
⎝
⎛
⎟⎠
⎞⎜⎝
⎛
⎠
⎞⎜⎝
⎛
12
2
12
2
2)(5.0)( M j
R M
j
R j
R j
Haan eeee
π ω
π ω
ωω β ΨΨΨΨ
Not for sale 336
8/12/2019 Chapter10 SM
http://slidepdf.com/reader/full/chapter10-sm 14/64
.
122sin
122)12(sin
122sin
122)12(sin
)2 / sin(
2
)12(sin
5.0
⎟⎠
⎞⎜⎝
⎛
⎟⎠
⎞⎜⎝
⎛⎟⎠
⎞⎜⎝
⎛
⎟⎠
⎞⎜⎝
⎛
⎟⎠
⎞⎜⎝
⎛⎟⎠
⎞⎜⎝
⎛
⎟⎠
⎞⎜⎝
⎛
=
M
M M
M
M M
M
π ω
π ω
π ω
π ω
ω
ω
For the Hamming window, = 0.54, = 0.46, and = 0. Hence,
⎟⎟⎟
⎠
⎞
⎜⎜⎜
⎝
⎛
⎟⎟⎟
⎠
⎞
⎜⎜⎜
⎝
⎛
⎟⎠
⎞⎜⎝
⎛
⎠
⎞⎜⎝
⎛
12
2
12
2
min 92.092.0)(54.0)( M j
R M
j
R j
R j
g Ham eeee
π ω
π ω
ωωΨΨΨΨ
122
sin
122)12(sin
92.0
122
sin
122)12(sin
92.0)2 / sin(
2
)12(sin
54.0
⎟
⎠
⎞⎜
⎝
⎛
⎟⎠
⎞⎜⎝
⎛⎟⎠
⎞⎜⎝
⎛
⎟
⎠
⎞⎜
⎝
⎛
⎟⎠
⎞⎜⎝
⎛⎟⎠
⎞⎜⎝
⎛
⎟⎠
⎞⎜⎝
⎛
=
M
M M
M
M M
M
π ω
π ω
π ω
π ω
ω
ω
or the Blackmann window = 0.42, = 0.5 and = 0.08
⎟⎟⎟
⎠
⎞
⎜⎜⎜
⎝
⎛
⎟⎟⎟
⎠
⎞
⎜⎜⎜
⎝
⎛
⎟⎠
⎞⎜⎝
⎛
⎠
⎞⎜⎝
⎛
12
2
12
2
)(42.0)( M j
R M
j
R j
R j
Blackman eeee
π ω
π ω
ωωΨΨΨΨ
⎟⎟⎟
⎠
⎞
⎜⎜⎜
⎝
⎛
⎟⎟⎟
⎠
⎞
⎜⎜⎜
⎝
⎛
⎟⎠
⎞⎜⎝
⎛
⎠
⎞⎜⎝
⎛
12
4
12
4
16.016.0 M j
R M
j
R ee
π ω
π ω
ΨΨ
⎟⎠
⎞⎜⎝
⎛
⎟⎠⎞⎜
⎝⎛ ⎟
⎠⎞⎜
⎝⎛
⎟⎠
⎞⎜⎝
⎛
⎟⎠⎞⎜
⎝⎛ ⎟
⎠⎞⎜
⎝⎛ ⎟
⎠⎞⎜
⎝⎛
=
122sin
122)12(sin
122sin
122)12(sin
)2 / sin(
2)12(sin
42.0
M
M M
M
M M M
π ω
π ω
π ω
π ω
ω
ω
.
12
2
2sin
12
2
2)12(sin
16.0
12
2
2sin
12
2
2)12(sin
16.0
⎟⎠
⎞⎜⎝
⎛
⎟⎠
⎞⎜⎝
⎛⎟⎠
⎞⎜⎝
⎛
⎟⎠
⎞⎜⎝
⎛
⎟⎠
⎞⎜⎝
⎛⎟⎠
⎞⎜⎝
⎛
M
M M
M
M M
π ω
π ω
π ω
π ω
10.20 (a) ( ) [ ] [ ] [ ] [ ] [ ]∑=−−−−− ++++=≈=
N
n
N n D z N h z h z hh z nh z z H 0
21 210 L
We see that if then[ ,ˆ2
1
∑
N
N k
k a k n x t Pt x ] ∏≠
⎟⎠
⎞⎜⎝
⎛
=
2
1
N
k l
N l lk
lk
t t
t t t P for 21 N k N ≤ .
Not for sale 337
8/12/2019 Chapter10 SM
http://slidepdf.com/reader/full/chapter10-sm 15/64
Here, we have and the solution follows if[ ]∑=
= N
n
n znh z H
0
ˆ
( ) [ ]nht P k = , , ,01 = N N N =2 nk = , Dt = , k t l = , and nt k =
Therefore, we have [ ] ∏≠
= =
N
nk
k k n
k Dnh
0 for N n ≤≤0 .
(b) N = 21, D = 90/13, L = 22. , where [ ]∑=
≈21
0n
n znh z H [ ] ∏≠
= =
21
0
13 / 90
nk
k k n
k nh .
% Problem #10.20
D = 90/13;
N = 21;for n = 0:N,
for k = 0:N,
if n ~= k,
tmp(n+1,k+1) = (D-k)/(n-k);
else
tmp(n+1,k+1) = 1;
end
end
end
h = prod(tmp');
[Gd,W] = grpdelay(h,1,512);
[H, w] = freqz(h,1,512);
figure(1);
plot(W/pi, Gd);
xlabel('\omega/\pi');
ylabel('Group Delay');
title('Group delay of z^-^D');
grid;
figure(2);
plot(w/pi, (abs(H)));
xlabel('\omega/\pi');
ylabel('Magnitude');title('Magnitude response of z^-^D');
grid;
Not for sale 338
8/12/2019 Chapter10 SM
http://slidepdf.com/reader/full/chapter10-sm 16/64
0 0.2 0.4 0.6 0.8 16.5
7
7.5
8
ω / π
G r o u p
D e l a y
Group delay of z-D
0 0.2 0.4 0.6 0.8 10.9
1
1.1
1.2
1.3
1.4
1.5
ω / π
M a g
n i t u d e
Magnitude response of z-D
10.21 (a) where is the desired signal and
is the harmonic interference with fundamental
frequency . Now,
],[][)sin(][][
0
nr nsnk Ansn x k o
M
k
k ∑=
φω ][ns
)sin(][ 0k o
M
k k nk Anr φω
∑=
oω ])(sin[][
0k o
M
k
k Dnk A Dnr φω ∑=
].[)2sin(
0
nr k nk A k o
M
k
k =∑=
π φω
(b) ][][][][][][][][][][][ nr Dnsnr ns Dnr Dnsnr ns Dn x n x n y
Hence, does not contain any harmonic disturbances.].[][ Dnsns ][n y
(c) .1
1)(
D D
D
c z
z z H
=
ρ Thus,
ω
ωω
ρ jD D
jD j
ce
ee H
=
1
1)(
sin()cos(1
)sin()cos(1
ω ρω ρ
ωω
D j D
D j D
D D =
Then, .)cos(21
)cos(12)(
2 D D
jc
D
De H
ρω ρ
ωω
= A plot of )( ω j
c e H for π ω 22.0o and
is shown below:99.0 ρ
Not for sale 339
8/12/2019 Chapter10 SM
http://slidepdf.com/reader/full/chapter10-sm 17/64
-1 -0.5 0 0.5 10
0.2
0.4
0.6
0.8
1
ω / π
A
m p l i t u d e
(d)x[n] y[n]
+–
z–D
10.22)(98.01
)(1
)(
)()(
z N
z N
zQ
zP z H
Dc
= , with π π 18.0 / 2 D , N = 18, and 98.0= ρ .
% Problem #10.23
close all;
clear;
clc;
D = 2/.18;
N = 18;
rho = 0.98;
for n = 0:N,for k = 0:N,
if n ~= k,
tmp(n+1,k+1) = (D-k)/(n-k);
else
tmp(n+1,k+1) = 1;
end
end
end
h = prod(tmp');
[H,w] = freqz(h,1,1024);
Hc = (1-H)./(1-(rho^D)*H);
x = sqrt((2*(1-cos(D*w)))./(1-2*(rho^D)*cos(D*w)+rho^(2*D)));
%plot(w/pi, abs(Hc));
plot(w/pi, x); grid;
xlabel('\omega/\pi');
ylabel('Magnitude');
title(‘Comb filter using FIR fractional delay');
Not for sale 340
8/12/2019 Chapter10 SM
http://slidepdf.com/reader/full/chapter10-sm 18/64
0 0.2 0.4 0.6 0.8 10
0.2
0.4
0.6
0.8
1
ω / π
M
a g n i t u d e
Comb filter using FIR fractional delay
10.23)(98.0)(
)()(
)(
)()(
11113 / 90
111
=
z D z z D
z D z z D
zQ
zP z H c , with 11.1118.0/2 == π π D and N = 11.
% Problem #10.23
close all;
clear;
clc;
D = 2/0.18;
rho = 0.98;
N = floor(D);
for k = 1:N,
for n = 0:N,
p(n+1) = (D-N+n)/(D-N+k+n);
end
d(k) = ((-1)^k)*nchoosek(N,k)*prod(p);
end
[H,w] = freqz(fliplr(d)-d, fliplr(d)-(rho^D).*d , 512);
plot(w/pi, abs(H));grid;
xlabel('\omega/\pi');
ylabel('Magnitude');
title(Comb filter using allpass IIR fractional delay');
0 0.2 0.4 0.6 0.8 10
0.2
0.4
0.6
0.8
1
ω / π
M a g n i t u d e
Comb filter using allpass IIR fractional delay
Not for sale 341
8/12/2019 Chapter10 SM
http://slidepdf.com/reader/full/chapter10-sm 19/64
10.24
⎪⎪
⎪
⎩
⎪
⎪⎪
⎨
⎧
≤⎟⎠
⎞
⎜⎝
⎛
≤⎟⎠
⎞
⎜⎝
⎛
≤
=
elsewhere.,0
,,1
,,1
,,1
)(
ps ps
p
s p ps
p
p p
j LP e H
ωωωωω
ωω
ωωωωω
ωω
ωωω
ω
Now, for ,0n ∫
=π
π
ωωω
π d ee H nh n j j
LP LP )(2
1][
⎥⎥⎥
⎦
⎤
⎢⎢⎢
⎣
⎡
⎟⎠
⎞
⎜⎝
⎛
⎟⎠
⎞
⎜⎝
⎛ ∫ ∫
s
p
p
s
p
p
d ed ed e n j pn j pn jω
ω
ω
ω
ωω
ω
ω
ω ωω
ωωω
ω
ωωω
π ∆∆11
2
1
⎥⎥⎥
⎦
⎤
⎢⎢⎢
⎣
⎡ ∫ ∫
s
p
p
s
s
s
d ed ed e n j pn j pn j
ω
ω
ω
ω
ωωω
ω
ω ωω
ωωωω
ωωωπ ∆∆21
⎪⎭
⎪⎬
⎫
⎪⎩
⎪⎨
⎧
⎥⎥
⎦
⎤
⎢⎢
⎣
⎡
⎥⎥
⎦
⎤
⎢⎢
⎣
⎡
p
s
s
p
n
e
jn
e
n
e
jn
e
n
n n jn j p
n jn j ps
ω
ω
ωωω
ω
ωω ωω
ω
ωω
ωπ
ω
π
–
–
22
)(1)(1)sin(2
2
1
∆∆
⎪⎭
⎪⎬
⎫
⎪⎩
⎪⎨
⎧
⎥⎥
⎦
⎤
⎢⎢
⎣
⎡ 22
1)sin(2
2
1
n
ee
jn
e
n
ee
jn
e
n
n n jn jn jn jn jn js
s ps pss ωωωωωωωω
ωπ
ω
π
∆∆
∆
⎪
⎪⎬⎫
⎪
⎪⎨⎧
⎥⎦
⎤
⎢⎣
⎡
2
)cos()cos()sin(2)sin(2
2
1
n
nn
n
n
n
n psss ωωωω
ωπ
ω
π
∆
∆
⎪
⎪⎬⎫
⎪
⎪⎨⎧
22
)cos()cos(1
n
n
n
ns p
π
ω
π
ω
ω∆
⎭⎩
=
22
))2 / cos(())2 / cos((1
n
n
n
n cc
π
ωω
π
ωω
ω
∆∆
∆
.)sin()2 / sin(2
n
n
n
n c
π
ω
ω
ω
∆
∆=
Next, for ,0n π ωπ
π
π
ω
2
1
)(2
1
]0[ =∫ d e H h
j
LP LP (area under the curve)
.22
1
π
ωc ps=
π
2 ωω
Not for sale 342
8/12/2019 Chapter10 SM
http://slidepdf.com/reader/full/chapter10-sm 20/64
Hence,⎪⎩
⎪⎨
⎧
≠
==
0. if 2sin(
0, if
nn
n
n
n
n
nhc
c
LP
,)sin()2 /
,][
π
ω
ω
ωπ
ω
∆
∆
An alternate approach to solving this problem is as follows. Consider the frequency response
⎪⎪⎪
⎩
⎪
⎪
⎨
⎧
<
≤
=
elsewhere.,0
,,1
,,1
–
,,0
)()(
ps
s p
p p
j LP j
d
e H d eG
ωωωω
ωωωω
ωωω
ω
ωω
∆
∆ Its inverse DTFT is given by
∫π
π–
)(2
1][ ωωω d eeGng n j j
ωω
ωω
ωω
ω
ω
ω
ω
d ed e n jn js
p
p
s
∫ππ ∆∆
1
2
11
2
1–
–
⎟
⎟⎟
⎠
⎞
⎜
⎜⎜
⎝
⎛
π
jn
n je
jn
n je
s
p
p
s
ωω
ω
ω
ω
ω
ω∆2
1 )cos()cos(
1nn
n j s p ωω
ω
π ∆.
Thus, ][][ ngn
jnh LP = )cos()cos(
12
nnn
s p ωωω
π
=∆
⎥⎦
⎤⎢⎣
⎡⎟⎠
⎞⎜⎝
⎛⎟⎠
⎞⎜⎝
⎛ ⎟
⎠
⎞⎜⎝
⎛⎟⎠
⎞⎜⎝
⎛
π= nn
nsc
2cos
2cos
12
ωω
ωω
ω
∆∆
∆
.0,)sin()2 / sin(2 ≠π
n for n
nnn cω
ωω
∆
∆
For ,0n .][πc
LP nh ω
10.25 Consider the case when the transition region is approximated by a second order spline. Inthis case the ideal frequency response can be constructed by convolving an ideal, no-
transition-band frequency response with a triangular pulse of width ps ωωω ∆ ,
which in turn can be obtained by convolving two rectangular pulses of width . In
the time domain this implies that the impulse response of a filter with transition bandapproximated by a second order spline is given by the product of the impulse response of
an ideal low pass filter with no transition region and square of the impulse response of arectangular pulse. Now,
2 / ω∆
Not for sale 343
8/12/2019 Chapter10 SM
http://slidepdf.com/reader/full/chapter10-sm 21/64
n
nn H c
ideal LPπ
ω )sin(][)( = and
4 /
)4 / sin(][
n
nn H rec
ω
ω
∆
∆= . Hence,
.)( ][][][ n H n H n H recideal LP LP = 2
Thus for a lowpass filter with a transition region approximated by a second order spline
⎪⎪⎩
⎪⎨
⎧
⎟⎠
⎞⎜⎝
⎛otherwise.
sin(
0,=n if
,)sin(
4 /
)4 /
,
][ 2
n
n
n
nnh
c
c
LP
π
ω
ω
ω
π
ω
∆
∆
Similarly the frequency response of a lowpass filter with the transition region specified by a
-th order spline can be obtained by convolving in the frequency domain an ideal filter with
transition region with rectangular pulses of width Hence,
, where the rectangular pulse is of width Thus
P
P . / Pω∆
Precideal LP LP n H n H n H ][][][ )( . / Pω∆
⎪⎪⎩
⎪⎨
⎧
⎟⎠
⎞⎜⎝
⎛otherwise.
sin(
if
,)sin(
2 /
)2 /
0,
][
n
n
Pn
Pn
,= n
nhc
P
c
LP
π
ω
ω
ω
π
ω
∆
∆
10.26 From Step 2, we have .)()()( )( ωωωωωδω
jN jN jN jeF eeGeG
F s
((
The amplitude response )(ωG(
has been obtained by raising the amplitude response
)(ωF (
by and hence, the filter has double zeros in the stopband.( ) F
sδ )( zG
Not for sale 344
8/12/2019 Chapter10 SM
http://slidepdf.com/reader/full/chapter10-sm 22/64
We may factorize as follows: where is a real-coefficient
minimum-phase FIR lowpass filter with half the degree of the original Since,
),()()( 1 z H z H z zG mm N )( z H m
).( z H ,0)( ≥ωG(
the amplitude response )(ωm H (
of the minimum-phase filter does not oscillate about
unity in the passband. Since the original frequency response was raised by
)( z H m( ) , F
sδ )(ωm H (
must be
normalized by a factor .1 sδ + Therefore,
For )(ωm H (
, we can sees
sF s
δ
δδ
1
2and 1
111
1
1 =
s
p
s
s pF p
δ
δ
δ
δδδ .
10.27 (a) N = 1 and hence, .)( 10 t t x a αα Without any loss of generality, for .5 L we first
fit the data set ,55]},[{ ≤k k x by the polynomial t t x a 10)( αα with a minimum
mean-square error at ,5,,1,0,1,,4,5 KK t , and then replace with a new value]0[ x
.)0(]0[ 0α x x
Now, the mean-square error is given by We set.][),(5
5
21010 ∑
k
k k x ααααε
0),(
0
10 =α
ααε
∂
∂ and 0
),(
1
10 =α
ααε
∂
∂ which yields and∑
5
5
5
5
10 ],[11k k
k x k αα
∑
5
5
5
5
21
5
50 ].[
k k k
k x k k k αα
From the first equation we get ∑
=5
50 ].[
11
1]0[
k
k x x α In the general case we thus
Not for sale 345
8/12/2019 Chapter10 SM
http://slidepdf.com/reader/full/chapter10-sm 23/64
have ∑
=5
50 ][
11
1][
k
k x n x α which is a moving average filter of length 11.
(b) and hence, Here, we fit the data set
by the polynomial with a minimum mean-squareerror at and then replace with a new value
,2 N .)( 2210 t t t x a ααα ]},[{ k x
,55 ≤k 2
,5,,1,0,1,,4,5 KK ]0[ x
210)( t t t x a ααα t
.)0( 0αa x ]0[ = x
5
The mean-square error is now given by
We set.][,,
5
22210210 ∑
k
k k k x ααααααε ,0),,(
0
210 =α
αααε∂
∂
,01
210 =α∂
),,( αααε∂ and ,0
2
210 =α∂
),,( αααε∂ which yields
From the
first and the third equations we then get
∑
=5
520 ],[11011
k
k x αα ∑
=5
51 ],[110
k
k x k α ∑
=5
5
220 ].[1958110
k
k x k αα
2
5
5
25
50
)110()111958(
][110][1958
=
∑ k k
k x k k x
α ].[589429
15
5
2 k x k
k
∑
Hence, here we replace ][n x with a new value 0][ αn x which is a weighted combination o
the original data set :55]},[{ ≤k k x
][589
429
1][
5
5
2 k n x k n x
k
∑
][89]1[84]2[69]3[44]4[9]5[36429
1( n x n x n x n x n x n x
.]5[36]4[9]3[44]2[69]1[84 )n x n x n x n x n x
(c) The impulse response of the FIR filter of Part (a) is given by
{ },1111111111111
1][1 =nh
whereas, the impulse response of the FIR filter of Part (b) is given by
{ }.36944698489846944936429
1][1 nh
The corresponding frequency responses are given by
,11
1)(
5
51 ∑
k
k j j ee H ωω and .589429
1)(
5
5
22 ∑
k
k j j ek e H ωω
Not for sale 346
8/12/2019 Chapter10 SM
http://slidepdf.com/reader/full/chapter10-sm 24/64
A plot of the magnitude responses of these two filters are shown below from which it can
be seen that the filter of Part (b) has a wider passband and thus provides smoothing over alarger frequency range than the filter of Part (a).
0 0.2 0.4 0.6 0.8 10
0.2
0.4
0.6
0.8
1
ω / π
M a g n i t u d e
H1(z)
H2(z)
10.28 ]2[46]3[21]4[3]5[5]6[6]7[3
320
1][ { n x n x n x n x n x n x n y
]4[3]3[21]2[46]1[67][74]1[67 n x n x n x n x n x n x
.]7[3]6[6]5[5 }n x n x n x
Hence, { ωωωωωω
ωω 34567
3 213563320
1
)(
)()( j j j j j
j
j j eeeee
e X
eY e H
}ωωωωωωωωω 7654322 3653214667746746 j j j j j j j j j eeeeeeeee .
{ })7cos(3–)6cos(6–)5cos(5–)4cos(3)3cos(21)2cos(46cos6774160
1ωωωωωωω
.)7cos(3–)6cos(6–)5cos(5– ωωω
The magnitude response of the above FIR filter is plotted below (solid line) along
with that of the FIR filter of Part (b) of Problem 10.27 (dashed line). Note that
both filters have roughly the same passband but the Spencer's filter has very largeattenuation in the stopband and hence it provides better smoothing than the filter of Part
(b).
)(3 z H
)(2 z H
0 0.2 0.4 0.6 0.8 10
0.2
0.4
0.6
0.8
1
ω / π
M a g n
i t u d e
H3(z)
H2(z)
Not for sale 347
8/12/2019 Chapter10 SM
http://slidepdf.com/reader/full/chapter10-sm 25/64
10.29 (a) . Now.3 L 33
221)( x x x x P ααα 0)0( =P is satisfied by the way has
been defined. Also to ensure
)( x P
1)1( =P we require 1321 =ααα . Choose 1m and
Since.1n ,0)(
0
== x dx
x dP hence ,032
02
321 == x
x x ααα implying 01 =α . Also
since ,0)(
1
== x dx
x dP hence 032 321 =ααα . Thus solving the three equations:
, ,and1321 =ααα 01 =α 032 321 =ααα
we arrive at , , and1 0 2 3 3 –2. Therefore, .23)( 32 x x x P
(b) Hence, . Choose and.4 L 44
33
221)( x x x x x P αααα 2m 1n
(alternatively one can choose 1m 2and =n
⇒ for better stopband performance ). Then,
1)1(P .14321 =αααα Also,
,04 3
4
x α320)(
0
2
3210
=== x x
x x dx
x dPααα
,012620)(
02
4320
2
2==
= x
x
x x dx
x Pd ααα
.04320)(
43211
==
αααα x dx
x dP
Solving the above four simultaneous equations we get and1 0, 2 0, 3 4, 4 – 3.
Therefore, .34)( x x x P 43
(c) Hence Choose and.5 L .)( 554433221 x x x x x x P ααααα 2m 2n .
Following a procedure similar to that in parts (a) and (b) we get
and1 0, 0, 10,
–15, 6.2 3
4 5
10.30 From Eq. (7.102) we have Now∑=
= M
k
k k c H
1
).sin(][)( ωω(
∑=
=
M
k
k M
k
M
k
k k ck k k ck k c H
1
1
11
).()1]([)cos()(sin][)(sin][)( ωπ ωωπ ωπ (
Thus, )()( ωπ ω H H ((
implies or
equivalently, which in turn implies that
∑ ∑= =
M
k
M
k
k k k ck k c
1 1
1 ),sin()1(][)sin(][ ωω
=
= M
k
k k k c
1
1 ,0)sin(][)1(1 ω 0][ =k c for
.,6,4,2 Kk
Not for sale 348
8/12/2019 Chapter10 SM
http://slidepdf.com/reader/full/chapter10-sm 26/64
But from Eq. (7.103) we have ,1],[2][ M k k M hk c ≤ or, ].[][2
1k M ck h For k eve
i.e., 0]2[]2[,22
= R M c Rh Rk 1
if M is even.
10.31 (a) Thus,.10),()(][ / 2 M k e H e H k H M k j j k π ω ,][1
][1
0∑= =
M
k
kn
M W k H
M nh
where . / 2 M k j M eW π =
Now, .][1
][1
][)(1
0
1
0
1
0
1
0
1
0∑ ∑∑
=
=
=
=
=
⎟⎟
⎠
⎞
⎜⎜
⎝
⎛=
M
k
M
n
nkn M
M
n
n M
k
kn M
M
n
n zW k H M
zW k H M
znh z H
We can write ∑∞
=
∞
=
=
M n
nkn M
n
nkn M
M
n
nkn M zW zW zW
0
1
0
.1
11
1000
=
∞
=
∞
=
=∑ zW
z zW z zW zW zW
k M
M
n
nkn M
M
n
nkn M
M kM M
n
nkn M
Therefore, .1
][1)(
1
01
=
= M
k k
M
M
zW
k H
M
z z H
(b)H[0]
M
H[1]
M
H[M 1]
M
x[n] y[n]
11 z 1
1
1 z 1e j2 /M
1
1 z 1e j2 (M 1)/M
1 z M
(c) Note .][11
][1)(1
0
1
0
1
01 ∑ ∑
=
=
= ⎟
⎟⎠
⎞
⎜⎜⎝
⎛=
=
M
k
M
n
nkn M
M
k k
M
M
zW k H M zW
k H M z z H
Not for sale 349
8/12/2019 Chapter10 SM
http://slidepdf.com/reader/full/chapter10-sm 27/64
On the unit circle the above reduces to .][1
)(1
0
1
0∑ ∑=
=
⎟⎟
⎠
⎞
⎜⎜
⎝
⎛=
M
k
M
n
n jkn M
j eW k H M
e H ωω For
we then get from the above, / 2 M j lπ ω = ∑ ∑= =
⎜⎜
⎝
⎛=
0 0
/ 2 / 2 1][)(
k n
M nkn M
M j eW
M
k H e H ll π π 1 1 M M
∑ ∑= =
⎟⎟
⎠
⎞
⎜⎜
⎝
⎛=
0 0
1][
k n
n M
kn M W W
M k H l
1 1 M M
.1
][
0 0
)(∑ ∑= =
⎟⎟
⎠
⎞
⎜⎜
⎝
⎛=
k n
nk M W
M k H
l1 1 M M
Using the identity of Eq.
(5.23) of text we observe that⎩
==
=
otherwise.,0
,if ,11
0
)( k W
M n
nk M
ll 1 M
Hence, ].[)( / 2 ll H e H M j =π
10.32 (a) For Type 1 FIR filter, .)()( 2
)1(ω
ω
ω j
M j
j
e H ee H
= Since in the frequency
sampling approach we sample the DTFT at)( ω je H M points given by ,2
M
k π ω =
therefore,10 M k ,)()(][ / )1(2 / 2 / 2 M M k j M k jd
M k j ee H e H k H = π π π
Since the filter is of Type 1,.10 M k 1 M is even, thus, .
Moreover, being real, Thus,
.12 / )1(2 = M k je π
][nh ).(*)( ωω j j e H e H = ,)()( 2 / )1( ωωω j M j j e H ee H =
Hence,.2π ωπ <
⎪⎩
⎪⎨
⎧ ==
=
.1,,2
32
12 / )1)((2 / 2
,2
12 / )1(2 / 2
,)(
,,2,1,0,)(][
M M M k M M k M j M k jd
M M M k j M k jd
ee H
k ee H k H
K
K
π π
π π
(b) For the Type 2 FIR filter
⎪⎪
⎩
⎪⎨
⎧
=
=
=
.1,,1,)(
,,0
,,2,1,0,)(
][
22 / )1)((2 / 2
2
,2
12 / )1(2 / 2
M k ee H
k
k ee H
k H
M M M k M j M k jd
M
M M M k j M k jd
K
K
π π
π π
10.33 (a) The frequency spacing between 2 consecutive DFT samples
is given by
.72788.155.0 =π ω p
.3307.019
2=
π The desired passband edge is between the frequency samples at
19
52π ω = and .
19
62π ω = Therefore, the 19-point DFT is given by
Not for sale 350
8/12/2019 Chapter10 SM
http://slidepdf.com/reader/full/chapter10-sm 28/64
⎩⎨⎧
=
==
.12,,6,0
,18,,14,13,5,,1,0,][
9)19 / 2(
K
KK
k
k ek H
k j π
A 19-point IDFT of the above DFT samples yields the impulse response coefficients
given below in ascending powers of :1− z
Columns 1 through 10
-0.0037 -0.0022 0.0224 -0.0211 -0.0231 0.0674
-0.0316 -0.1128 0.2888 0.6316
Columns 11 through 19
0.2888 -0.1128 -0.0316 0.0674 -0.0231 -0.0211
0.0224 -0.0022 -0.0037
(b)
0 0.2 0.4 0.6 0.8 10
0.2
0.4
0.6
0.8
1
ω / π
M a g n i t u d e
% Problem #10.33
close all;
clear;
clc;
ind = 1;
for k = 0:5,
H(ind) = exp(-i*2*pi*9*k/19);
ind = ind + 1;
end
for k = 6:12,
H(ind) = 0;
ind = ind + 1;
end
for k = 13:18,H(ind) = exp(-i*2*pi*9*k/19);
ind = ind + 1;
end
h = ifft(H);
figure(1);
stem(real(h));
[FF, w] = freqz(h, 1, 512);
Not for sale 351
8/12/2019 Chapter10 SM
http://slidepdf.com/reader/full/chapter10-sm 29/64
figure(2);
plot(w/pi, abs(FF)); axis([0 1 0 1.2]);grid;
ylabel('Gain, in dB'); xlabel('\omega/\pi');
10.34 (a) The frequency spacing between 2 consecutiveDFT samples
is given by
.09956.135.0 =π ω p
.1611.0392 =π The desired passband edge is between the frequency samples
at39
62π ω = and
39
72π ω = . Therefore, the 39-point DFT is given by
⎩⎨⎧
=
==
.31,,7,0
,38,,33,32,6,,1,0,][
19)39 / 2(
K
KK
k
k ek H
k j π
A 39-point IDFT of the above DFT samples yields the impulse response coefficients
given below in ascending powers of :1− z
Columns 1 through 10
0.0006 0.0031 0.0017 -0.0054 -0.0091 -0.0010
0.0128 0.0146 -0.0034 -0.0237
Columns 11 through 20
-0.0192 0.0134 0.0405 0.0227 -0.0362 -0.0753
-0.0249 0.1222 0.2870 0.3590
Columns 21 through 30
0.2870 0.1222 -0.0249 -0.0753 -0.0362 0.0227
0.0405 0.0134 -0.0192 -0.0237
Columns 31 through 39
-0.0034 0.0146 0.0128 -0.0010 -0.0091 -0.0054
0.0017 0.0031 0.0006
(b)
0 0.2 0.4 0.6 0.8 10
0.2
0.4
0.6
0.8
1
ω / π
M a g n i t u d e
% Problem #10.34 close all;
clear;
clc;
ind = 1;
for k = 0:6,
Not for sale 352
8/12/2019 Chapter10 SM
http://slidepdf.com/reader/full/chapter10-sm 30/64
H(ind) = exp(-i*2*pi*19*k/39);
ind = ind + 1;
end
for k = 7:31,
H(ind) = 0;
ind = ind + 1;
end for k = 32:38,
H(ind) = exp(-i*2*pi*19*k/39);
ind = ind + 1;
end
h = ifft(H);
figure(1);
stem(real(h));
[FF, w] = freqz(h, 1, 512);
figure(2);
plot(w/pi, abs(FF)); axis([0 1 0 1.2]); grid;
xlabel('\omega/\pi'); ylabel('Gain, dB');
10.35 By expressing where Tn(x) is the -th order Chebyshev
polynomial in
),(cos)cos( ωω nT n = )( x T n n
, x we first rewrite Eq. (10.48) in the form:
.)(cos)cos(][)(
00∑=
= M
n
nn
M
n
nna H ωαωω(
Therefore, we can rewrite Eq. (10.70) repeated below for convenience
] ,21,)1()()()( M i D H P iiii εωωω
in a matrix form as
.
)(
)(
)()(
)( / )1()(cos)cos(1
)( / )1()(cos)cos(1
)( / 1)(cos)cos(1)( / 1)(cos)cos(1
2
1
2
1
1
0
21
22
111
222
111
⎥⎥⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢⎢⎢
⎣
⎡
=
⎥⎥⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢⎢⎢
⎣
⎡
⎥⎥⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢⎢⎢
⎣
⎡
M
M M
M M
M M
M
M M
M M
M
M
M
D
D
D
D
P
P
P
P
ω
ω
ω
ω
ε
α
α
α
ωωω
ωωω
ωωω
ωωω
M
L
L
MMOMM
L
L
Note that the coefficients are different from the coefficients of Eq. (10.70). To
determine the expression of we use Cramer's rule arriving at
}{ iα ]}[{ ia
, where
,
)( / )1()(cos)cos(1
)( / )1()(cos)cos(1
)( / 1)(cos)cos(1
)( / 1)(cos)cos(1
det
21
22
111
222
111
=
M M
M M
M
M M
M M
M
M
M
P
P
P
P
ωωω
ωωω
ωωω
ωωω
L
L
MMOMM
L
L
∆ and
Not for sale 353
8/12/2019 Chapter10 SM
http://slidepdf.com/reader/full/chapter10-sm 31/64
.
)()(cos)cos(1
)()(cos)cos(1
)()(cos)cos(1
)()(cos)cos(1
222
111
222
111
=
M M M M
M M M
M
M
M
D
D
D
D
ωωω
ωωω
ωωω
ωωω
ε
L
L
MMOMM
L
L
∆ .
Expanding both determinants using the last column we get and)( 1
2
1
=∑ i
M
i
i Db ωε∆
,)(
)1( 12
1 i
i M
i
iP
bω
=
= ∑∆ where
.
)(cos)(cos)cos(1
)(cos)(cos)cos(1
)(cos)(cos)cos(1
)(cos)(cos)cos(1
)(cos)(cos)cos(1
det
222
2
112
1
112
1
222
2
112
1
M M
M M
i M
ii
i M
ii
M
M
ib
ωωω
ωωω
ωωω
ωωω
ωωω
L
MOMMM
L
L
MOMMM
L
L
The above matrix is seen to be a Vandermonde matrix and is determinant is given by
Define).cos(cos
,
,l
l
ll
ωω ∏
≠
>
ik
k k
k ib .2
1∏≠=
= M
ir r
r
ii
b
bc It can be shown by induction that
.coscos
1
1∏≠
in
n niic
ωω
2 M
Therefore,
)(
)1(
)(
2
1
1
i
i M
i
i
i
ii
Pb
Db
ω
ω
ε
=
∑
∑
=
=
2 M
.
)(
)1(
)()(
)()()(
2
12
2
2
1
1
222211
=
M
M M
M M
P
c
P
c
P
c
Dc Dc Dc
ωωω
ωωω
L
L
10.36
⎪⎩
⎪⎨
⎧
∈
∈
=stopband.
passband,1
ωδ
δ
ω
ω
s
pW ⎩ ≤
≤=
.55.05.4
,45.001
π ωπ
π ωωW
Not for sale 354
8/12/2019 Chapter10 SM
http://slidepdf.com/reader/full/chapter10-sm 32/64
10.37⎪⎩
⎪⎨
⎧
∈
∈
=stopband.
passband,1
ωδ
δ
ω
ω
s
pW ⎩ ≤
≤=
.7.04.3
,55.001
π ωπ
π ωωW
10.38⎪⎩
⎪⎨
⎧
≤
≤
≤
=
⎪
⎪
⎩
⎪
⎪
⎨
⎧
≤
≤
≤
=
.82.05
,7.055.01
,44.0043.1
,
,1
,0
22
21
11
π ωπ
π ωπ
π ω
π ωωδ
δ
ωωω
ωωδδ
ω
ss
p
p p
ss
p
W
10.39 It follows from Eq. (10.22) that the impulse response of an ideal Hilbert transformer is anantisymmetric sequence. If we truncate it to a finite number of terms between M n M ≤ the impulse response is of length )12( M which is odd. Hence the FIR Hilbert transformer
obtained by truncation and satisfying Eq. (10.90) cannot be satisfied by a Type 4 FIR filter.
10.40 (a) Thus, .][)(1
0∑=
= N
n
n zn x z X
,)(
)(
1][)()(
1
01
1
1 1
11
z D
zP
z
zn x z X z X
N
n z
z z (
(
(
((
(
( =⎟⎠
⎞⎜⎝
⎛
= ∑
= =
α
α
α
α where
,)()1]([][)( 1111
0
1 nn N N
n
z zn x zn p zP
=
∑ ((((αα and
.)1(][)( 11
1
0
=
∑ N
N
n
n z znd z D ((( α
(b) ,][
][
)(
)()(][
/ 2 / 2
k D
k P
z D
zP z X k X
N k je z N k je z
(
(
(
(((
(( =
= π π where N k je z
zPk P / 2)(][ π =(
(( is
the -point DFT of the sequence N ][n p and N k je z z Dk D / 2)(][ π =
(((
is the -point DFT
of the sequence
N
].[nd
(c) Let and]T N p p p ]1[]1[]0[ LP [ ] .]1[]1[]0[ T
N x x x LX Without
any loss of generality, assume 4 N in which case ∑=
=0
][)(
n
n zn p zP ((3
]3[]2[]1[]0[ x x x x ααα 32
1222 ]3[3]2[)2(]1[)21(]0[3 z x x x x (
ααααα
2222 ]3[3]2[)21(]1[)2(]0[3 z x x x x (
ααααα
Not for sale 355
8/12/2019 Chapter10 SM
http://slidepdf.com/reader/full/chapter10-sm 33/64
.]3[]2[]1[]0[ 323 z x x x x (
αααα Equating like powers of 1 z(
we can write
where,XQP ⋅ [ ] ,]3[]2[]1[]0[ T p p p pP [ ]T
x x x x ]3[]2[]1[]0[X and
.
1
321)2(33)2(213
1
223
222222
⎥
⎥⎥⎥
⎦
⎤
⎢
⎢⎢⎢
⎣
⎡
=
ααα
ααααα
ααααα
ααα
Q
32
It can be seen that the elements ,3,0,, ≤sr q sr q , of the 4 matrix Q can be
determined as follows:
r ,s 4
(i) The first row is given by ,)(,0 s
sq α
(ii) The first column is given by ,)(
)!3(!
!3)(3
0, r r
r r
r r
C q αα and
(iii) the remaining elements can be obtained using the recurrence relation
.,11,1,1, sr sr sr sr qqqq αα
In the general case, we only change the computation of the elements of the first column
using the relation .)()!1(!
)!1()(1
0, r r
r N
r r N r
N C q αα =
M10.1 The impulse response coefficients of the truncated FIR highpass filter with cutoff
frequency at can be generated using the following MATLAB statements: π 4.0
n = -M:M;
num = -0.4*sinc(0.4*n);
num(M+1) = 0.6;
The magnitude responses of the truncated FIR highpass filter for two values of M areshown below:
0 0.2 0.4 0.6 0.8 10
0.2
0.4
0.6
0.8
1
ω / π
M a g n i t u d e
M=5M=20
Not for sale 356
8/12/2019 Chapter10 SM
http://slidepdf.com/reader/full/chapter10-sm 34/64
M10.2 The impulse response coefficients of the truncated FIR bandpass filter with cutoff
frequencies at 0.7π and 0.3π can be generated using the following MATLAB statements:
n = -M:M;
num = 0.7*sinc(0.7*n) - 0.3*sinc(0.3*n);
The magnitude responses of the truncated FIR bandpass filter for two values of M are shown below:
0 0.2 0.4 0.6 0.8 10
0.2
0.4
0.6
0.8
1
ω / π
M a g n i t u d e
M=5M=20
M10.3 The impulse response coefficients of the truncated Hilbert transformer can be generated
using the following MATLAB statements:
n = 1:M;
c = 2*sin(pi*n/2).*sin(pi*n/2);b = c./(pi*n);
num = [-fliplr(b) 0 b];
The magnitude responses of the truncated Hilbert transformer for two values of M are
shown below:
0 0.2 0.4 0.6 0.8 10
0.2
0.4
0.6
0.8
1
ω / π
M a g n i t u d e
M=5M=20
M10.4% Problem #M10.4
% Cascade of 2 boxcar filters of length 4
K = 2;N = 4;b = firgauss(K,N);
figure(1);
stem(b);xlabel(‘n’);ylabel(‘h[n]’);
title('Cascade of 2 boxcar filters of length 4');
Not for sale 357
8/12/2019 Chapter10 SM
http://slidepdf.com/reader/full/chapter10-sm 35/64
% Cascade of 4 boxcar filters of length 4
K = 4;N = 4;b = firgauss(K,N);
figure(2);
stem(b);xlabel(‘n’);ylabel(‘h[n]’);
title('Cascade of 4 boxcar filters of length 4');
% Cascade of 2 boxcar filters of length 12 K = 2;N = 12;b = firgauss(K,N);
figure(3);
stem(b);xlabel(‘n’);ylabel(‘h[n]’);
title('Cascade of 2 boxcar filters of length 12');
% Cascade of 4 boxcar filters of length 12
K = 4;N = 12;b = firgauss(K,N);
figure(4);
stem(b);xlabel(‘n’);ylabel(‘h[n]’);
title('Cascade of 4 boxcar filters of length 12');
1 2 3 4 5 6 70
1
2
3
4
n
h [ n ]
Cascade of 2 boxcar filters of length 4
0 5 10 15
0
10
20
30
40
50
n
h [ n ]
Cascade of 4 boxcar filters of length 4
0 5 10 15 20 250
2
4
6
8
10
12
n
h [ n ]
Cascade of 2 boxcar filters of length 12
0 10 20 30 40 50
0
200
400
600
800
1000
1200
n
Cascade of 4 boxcar filters of length 12
We can see that by increasing either K or N , the approximation to a Gaussian function
gets better. It is noted that increasing the number of boxcar filters K to a number greaterthan 3 greatly affects the Gaussian shape of the impulse response.
M10.5 % Problem #M10.05 N = 36;fc = 0.2*pi;
M = N/2;
n = -M:1:M;t = fc*n;
lp = fc*sinc(t);
Not for sale 358
8/12/2019 Chapter10 SM
http://slidepdf.com/reader/full/chapter10-sm 36/64
b = 2*[lp(1:M) (lp(M+1) - 0.5) lp((M+2):N+1)];
bw = b.*hamming(N+1)';
[h2, w] = freqz(bw, 1, 512);
plot(w/pi, abs(h2));axis([0 1 0 1.2]);
xlabel('\omega/\pi');ylabel('Magnitude');
title(['\omega_c = ', num2str(fc), ', N = ', num2str(N)]);
0 0.2 0.4 0.6 0.8 10
0.2
0.4
0.6
0.8
1
ω / π
M a g n i t u d e
ωc = 0.62832, N = 36
M10.6 Its approximation over the range....)( 5505423 2 −+= x x x D 23 ≤≤− x is given by
We want to minimize the peak value of the absolute error, i.e.,
minimize
.)( xaa x A 10 +=
....max xaa x x x
102
235505423 −−−+
≤≤− Since there are 3 unknowns,
and we need 3 extremal points on , which we arbitrarily choose as
,, 10 aa
,ε x ,31 −= x ,02 = x
and We then solve the 3 linear equations:
This leads to whose solution yields
.23 = x .,,),()( 321110 ==ε−−+ lll x D xaa
,
.
..
⎥
⎥
⎦
⎤
⎢
⎢
⎣
⎡−=
⎥⎥
⎦
⎤
⎢⎢
⎣
⎡
ε⎥
⎥
⎦
⎤
⎢
⎢
⎣
⎡−
−
415
551511
121
101131
1
0a
a
,.,. 85014 10 == aa
and A plot of the corresponding error is shown
below in Figure (c).
..69=ε 692323 21 ...)( −+= x x xE
-3 -2 -1 0 1 2
-10
-5
0
5
10
x
E r r o r
Result of first guess
-3 -2 -1 0 1 2
-10
-5
0
5
10
x
E r r o r
Result of second guess
(c) (d)
Not for sale 359
8/12/2019 Chapter10 SM
http://slidepdf.com/reader/full/chapter10-sm 37/64
After looking at , we move the second extremal point to the location where)( x1E 2 x
is a minimum. The next extrtemal points are therefore given by)( x1E ,31 −= x
and The new values of the unknowns are obtained by solving,.502 −= x .23 = x
, which yields.
...⎥⎥⎦
⎤⎢⎢⎣
⎡−=⎥⎥
⎦
⎤⎢⎢
⎣
⎡
ε⎥⎥⎦
⎤⎢⎢⎣
⎡ −−−415
7256 15111211501 131
10aa ,.,. 85073 10 == aa and A plot
of the corresponding error is shown on the previous page in
Figure (d).
.10=ε
292323 22 ...)( −+= x x xE
% Problem #M10.06
x = [-3 0 2];
d = 3.2.*x.^2 + 4.05.*x-5.5;
D = d';
A = [1 -3 1;1 0 -1;1 2 1];
C = inv(A)*D;
y = -3:0.05:2;
E = 3.2.*y.^2 + 4.05.*y - 5.5 - C(1) - C(2).*y;
% Results of first guess
figure(1);
plot(y,E);
axis([-3 2 -12 12]);
xlabel('x');
ylabel('Error');
title('Result of first guess');
hold on;plot([-3 -3], [E(1) E(1)], 'o');
plot([2 2], [E(end) E(end)], 'o');
plot([0 0], [E(61) E(61)], 'o');
hold off;
x = [-3 -0.5 2];
d = 3.2.*x.^2 + 4.05.*x-5.5;
D = d';
A = [1 -3 1;1 -0.5 -1;1 2 1];
C = inv(A)*D;
y = -3:0.05:2;E = 3.2.*y.^2 + 4.05.*y - 5.5 - C(1) - C(2).*y;
% Results of second guess
figure(2);
plot(y,E);
axis([-3 2 -12 12]);
xlabel('x');
ylabel('Error');
Not for sale 360
8/12/2019 Chapter10 SM
http://slidepdf.com/reader/full/chapter10-sm 38/64
title('Result of second guess');
hold on;
plot([-3 -3], [E(1) E(1)], 'o');
plot([2 2], [E(end) E(end)], 'o');
plot([-0.5 -0.5], [E(51) E(51)], 'o');
hold off;
M10.7 . Its approximation over the range is given by
We want to minimize the peak value of the absolute error, i.e.,
minimize
( ) 558205 23 .. ++−−= x x x x D 22 ≤≤− x
.)( 2210 xa xaa x A ++=
...max 2210
23
22558205 xa xaa x x x
x−−−++−−
≤≤− Since there are 4
unknowns, and,,, 210 aaa ,ε we need 4 extremal points on , which we arbitrarily
choose as
x
,21 −= x ,12 −= x ,13 = x and .24 = x We then solve the 4 linear equations:
This leads to
whose solution yields
.,,,),()( 432112210 ==ε−−++ ll
l x D xa xaa
,
....
⎥⎥⎥
⎦
⎤
⎢⎢⎢
⎣
⎡
−
=⎥⎥⎥
⎦
⎤
⎢⎢⎢
⎣
⎡
ε⎥⎥⎥
⎦
⎤
⎢⎢⎢
⎣
⎡
−
−−−
3193832728
142111111111
1421
2
10
a
aa
,.,,. 20755 210 −=−== aaa
and A plot of the corresponding error is shown below in
Figure (e). We observe that these values maximize the error (ε = 10).
.10=ε x x x 155 31 +−=)(E
-2 -1 0 1 2
-10
-5
0
5
10
x
E r r o
r
Result of first guess
% Problem #M10.07
x = [-2 -1 1 2];
d = -5.*x.^3 - 0.2.*x.^2 + 8.*x + 5.5;
D = d';
A = [1 -2 4 1;1 -1 1 -1;1 1 1 1;1 2 4 -1];
C = inv(A)*D;
y = -2:0.05:2;
E = -5.*y.^3 - 0.2.*y.^2 + 8.*y + 5.5 - C(1) - C(2).*y -
C(3).*y.^2;
% Results of first guess
figure(1);
Not for sale 361
8/12/2019 Chapter10 SM
http://slidepdf.com/reader/full/chapter10-sm 39/64
plot(y,E);
axis([-2 2 -12 12]);
xlabel('x');
ylabel('Error');
title('Result of first guess');
hold on;
plot([-2 -2], [E(1) E(1)], 'o');plot([2 2], [E(end) E(end)], 'o');
plot([-1 -1], [E(21) E(21)], 'o');
plot([1 1], [E(1) E(1)], 'o');
hold off;
M10.818
8π=ω p ,
18
12π=ω s ,
18
10π=ωT
% Problem #M10.8
wp = 4*(2*pi)/18;
ws = 6*(2*pi)/18;
wc = (wp + ws)/2;
dw = ws - wp;
% Hamming
M = ceil(3.32*pi/dw);N = 2*M+1;n = -M:M;
num = (6/18)*sinc(6*n/18);
wh = hamming(N)';b = num.*wh;
figure(1);
k=0:2*M:stem(k,b);
title('Impulse Response Coefficients');
xlabel('Time index n'); ylabel('Amplitude');
figure(2);
[h, w] = freqz(b,1,512);
plot(w/pi, 20*log10(abs(h))); grid;
xlabel('\omega/\pi'); ylabel('Gain, in dB');
title('Lowpass filter designed using Hamming window');
axis([0 1 -80 10]);
% Hann
M = ceil(3.11*pi/dw);N = 2*M+1;n = -M:M;
num = (6/18)*sinc(6*n/18);
wh = hann(N)';b = num.*wh;
figure(3);
k=0:2*M:stem(k,b);
title('Impulse Response Coefficients');
xlabel('Time index n'); ylabel('Amplitude');
figure(4);
[h, w] = freqz(b,1,512);
plot(w/pi, 20*log10(abs(h)));grid;
xlabel('\omega/\pi');ylabel('Gain, in dB');
Not for sale 362
8/12/2019 Chapter10 SM
http://slidepdf.com/reader/full/chapter10-sm 40/64
title('Lowpass filter designed using Hann window');
axis([0 1 -80 10]);
% Blackman
M = ceil(5.56*pi/dw);N = 2*M+1;n = -M:M;
num = (6/18)*sinc(6*n/18);
wh = blackman(N)';b = num.*wh;
figure(5);
k=0:2*M:stem(k,b);
title('Impulse Response Coefficients');
xlabel('Time index n'); ylabel('Amplitude');
figure(6);
[h, w] = freqz(b,1,512);
plot(w/pi, 20*log10(abs(h)));grid;
xlabel('\omega/\pi');ylabel('Gain, in dB');
title('Lowpass filter designed using Blackman window');
axis([0 1 -80 10]);
Lowpass filter design using Hamming window: N = 31
0 5 10 15 20 25 30-0.1
0
0.1
0.2
0.3
0.4Impulse Response Coefficients
Time index n
m p
u
e
0 0.2 0.4 0.6 0.8 1-80
-60
-40
-20
0
ω / π
G a i n ,
i n d B
Lowpass filter designed using Hamming window
Lowpass filter design using Hann window: N = 29
0 5 10 15 20 25-0.1
0
0.1
0.2
0.3
0.4Impulse Response Coefficients
Time index n
a g n
u
e
0 0.2 0.4 0.6 0.8 1
-80
-60
-40
-20
0
ω / π
G a i n ,
i n d B
Lowpass filter designed using Hann window
Lowpass filter design using Blackman window: N = 53
Not for sale 363
8/12/2019 Chapter10 SM
http://slidepdf.com/reader/full/chapter10-sm 41/64
0 10 20 30 40 50-0.1
0
0.1
0.2
0.3
Impulse Response Coefficients
Time index n
a g n
u
e
0 0.2 0.4 0.6 0.8 1
-80
-60
-40
-20
0
ω / π
G a i n ,
i n d B
Lowpass f ilter designed using Blackman window
Comments: The Hann window method results in using the lowest filter order. All filters
meet the requirements of the specifications.
M10.9 ,42sα 631.3214207886.021425842.0 4.0 = β using Eq. (10.41).
⎟⎠
⎞⎜⎝
⎛
=
18
2285.2
842
π N using Eq. (10.42).
N = 42.627 43 and we choose 44 since N must be even. M = 22.% Problem #M10.9
beta = 3.631;N = 44;n = -N/2:N/2;
num = (6/18)*sinc(6*n/18);
wh = kaiser(N+1,beta)';b = num.*wh;
figure(1);
stem(b);
title('Impulse Response Coefficients');
xlabel('Time index n');ylabel('Amplitude')
figure(2);
[h, w] = freqz(b,1,512);
plot(w/pi, 20*log10(abs(h)));grid;
xlabel('\omega/\pi');ylabel('Gain, in dB');
title('Lowpass filter designed using Kaiser window');
axis([0 1 -80 10]);
0 10 20 30 40-0.1
0
0.1
0.2
0.3
0.4Impulse Response Coefficients
Time index n
m p
u
e
0 0.2 0.4 0.6 0.8 1
-80
-60
-40
-20
0
ω / π
G a i n ,
i n d B
Lowpass filter designed using Kaiser window
Not for sale 364
8/12/2019 Chapter10 SM
http://slidepdf.com/reader/full/chapter10-sm 42/64
M10.10 ,π ω 4.0 p π 6.0= s , 42= sα dB, π 5.0=c , π 2.0=∆
We will use the Hann window since it meets the requirements and has the lowest order
from Table 10.2.
.321655.15
11.3
= N M ω
π
∆ % Problem M10.10
n = -16:16;
lp = 0.5*sinc(0.5*n);wh = hanning(33);
b = lp.*wh';
figure(1);
k=0:2*n;stem(k,b);
title('Impulse Response Coefficients');
xlabel('Time index n');ylabel(‘Amplitude');
figure(2);
[h, w] = freqz(b,1,512);
plot(w/pi, 20*log10(abs(h)));grid;
xlabel('\omega/\pi');ylabel('Gain, in dB');
title('Lowpass filter designed using Hann window');
axis([0 1 -80 10]);
0 5 10 15 20 25 30-0.1
0
0.1
0.2
0.3
0.4
0.5
Impulse Response Coefficients
Time index n
m p
u
e
0 0.2 0.4 0.6 0.8 1
-80
-60
-40
-20
0
ω / π
G a i n ,
i n d B
Lowpass filter designed using Hann window
M10.11 We use the same specifications from Problem M10.10, but we use the Dolph-Chebyshev
window. ( )
( )748
202852
416420562.
..
..=
π
−= N . We use N = 50, which is a much higher order
than in Problem M10.10. % Pr obl em M10. 11 n = - 25: 25;
l p = 0. 5*s i nc( 0. 5*n) ; wh = chebwi n( 51, 42) ;b = l p. *wh' ;f i gure( 1) ;st em( b) ;t i t l e( ' I mpul se Response Coef f i ci ent s' ) ;xl abel ( ' Ti me i ndex n' ) ; yl abel ( ' Ampl i t ude' ) ;f i gure( 2) ;[ h, w] = f r eqz( b, 1, 512) ;
Not for sale 365
8/12/2019 Chapter10 SM
http://slidepdf.com/reader/full/chapter10-sm 43/64
pl ot ( w/ pi , 20*l og10( abs( h) ) ) ; gr i d;xl abel ( ' \ omega/ \ pi ' ) ; yl abel ( ' Magni t ude' ) ;t i t l e( ' Fi l t er desi gned usi ng Dol ph- Chebyshev wi ndow' ) ;axi s( [ 0 1 - 80 10] ) ;
0 10 20 30 40 50-0.2
0
0.2
0.4
0.6Impulse Response Coefficients
Time index n
m p
u
e
0 0.2 0.4 0.6 0.8 1
-80
-60
-40
-20
0
ω / π
M a g n i t u d e
Filter designed using Dolph-Chebyshev window
M10.12 n = -16:16; b = fir1(32, 0.5, hanning(33));
figure(1);
stem(b);
title('Impulse Response Coefficients');
xlabel('Time index n');ylabel(' Ampl i t ude' );figure(2);
[h, w] = freqz(b,1,512);
plot(w/pi, 20*log10(abs(h)));
grid;
xlabel('\omega/\pi');ylabel('Magnitude');
title(' Lowpass filter designed using Hann window');
axis([0 1 -80 10]);
0 5 10 15 20 25 30-0.2
0
0.2
0.4
0.6Impulse Response Coefficients
Time index n
m p
u
e
0 0.2 0.4 0.6 0.8 1-80
-60
-40
-20
0
ω / π
M a g n i t u d e
Lowpass filter designed using Hann window
M10.13 N = 35; f or k = 1: N+1,
w( k) = 2*pi *( k- 1) / ( N+1) ;i f ( w( k) >= 0. 45*pi & w( k) <= 1. 45*pi ) H( k) = 1;el se H( k) = 0;end i f ( w( k) <= pi ) phase( k) = i *exp( - i *w( k) *N/ 2) ;el se phase( k) = - i *exp( i *( 2*pi - w( k) ) *N/ 2) ;
Not for sale 366
8/12/2019 Chapter10 SM
http://slidepdf.com/reader/full/chapter10-sm 44/64
end end H = H. *phase;f = i f f t ( H) ;[ FF, w] = f r eqz( f , 1, 512) ;k = 0: N;f i gure( 1) ;stem( k, real ( f ) ) ;xl abel ( ' Ti me i ndex n' ) ; yl abel ( ' Ampl i t ude' ) ;f i gure( 2) ;pl ot ( w/ pi , 20*l og10( abs( FF) ) ) ; gr i dxl abel ( ' \ omega/ \ pi ' ) ; yl abel ( ' Gai n, dB' ) ;axi s( [ 0 1 - 50 5] ) ;
0 5 10 15 20 25 30 35-0.5
0
0.5
Time index n
m p
u e
0 0.2 0.4 0.6 0.8 1
-50
-40
-30
-20
-10
0
ω / π
G a i n ,
d B
M10.14 N = 45; L = N + 1;
for k = 1:L,
w = 2*pi*(k-1)/L;if (w >= 0.5*pi & w <= 0.7*pi) H(k) = i*exp(-i*w*N/2);
elseif (w >= 1.3*pi & w <= 1.5*pi) H(k) = -
i*exp(i*(2*pi-w)*N/2);
else H(k) = 0;
end
end
f = ifft(H);
[FF, w] = freqz(f, 1, 512);
k = 0:N;
figure(1);
stem(k, real(f));
xlabel('Time index, n');ylabel('h[n]');figure(2);
plot(w/pi, 20*log10(abs(FF)));grid;
ylabel('Gain, dB');xlabel('\omega/\pi');
axis([0 1 -50 5]);
Not for sale 367
8/12/2019 Chapter10 SM
http://slidepdf.com/reader/full/chapter10-sm 45/64
0 10 20 30 40-0.2
-0.1
0
0.1
0.2
Time index, n
n
0 0.2 0.4 0.6 0.8 1-50
-40
-30
-20
-10
0
G a i n
, d B
ω / π
M10.15 ind = 1; for k = 0:6,
H(ind) = exp(-i*2*pi*19*k/39);
ind = ind + 1;
end k = 7;
H(ind) = 0.5*exp(-i*2*pi*19*k/39);
ind = ind + 1;
for k = 8:30,
H(ind) = 0;
ind = ind + 1;
end
k = 31;
H(ind) = 0.5*exp(-i*2*pi*19*k/39);
ind = ind + 1;
for k = 32:38,
H(ind) = exp(-i*2*pi*19*k/39);
ind = ind + 1;
end
h = ifft(H);
[FF, w] = freqz(h, 1, 512);
plot(w/pi, 20*log10(abs(FF)));grid;
xlabel('\omega/\pi');ylabel('Gain, dB');
axis([0 1 -50 5]);
0 0.2 0.4 0.6 0.8 1-50
-40
-30
-20
-10
0
ω / π
G a i n
, d B
M10.16 ind = 1;
Not for sale 368
8/12/2019 Chapter10 SM
http://slidepdf.com/reader/full/chapter10-sm 46/64
for k = 0:6,
H(ind) = exp(-i*2*pi*19*k/39);
ind = ind + 1;
end
k = 7;
H(ind) = (2/3)*exp(-i*2*pi*19*k/39);
ind = ind + 1;k = 8;
H(ind) = (1/3)*exp(-i*2*pi*19*k/39);
ind = ind + 1;
for k = 9:29,
H(ind) = 0;
ind = ind + 1;
end
k = 30;
H(ind) = (1/3)*exp(-i*2*pi*19*k/39);
ind = ind + 1;
k = 31;
H(ind) = (2/3)*exp(-i*2*pi*19*k/39);ind = ind + 1;
for k = 32:38,
H(ind) = exp(-i*2*pi*19*k/39);
ind = ind + 1;
end
h = ifft(H);
[FF, w] = freqz(h, 1, 512);
plot(w/pi, 20*log10(abs(FF)));grid;
xlabel('\omega/\pi');ylabel('Gain, dB');
axis([0 1 -50 5]);
0 0.2 0.4 0.6 0.8 1-50
-40
-30
-20
-10
0
ω / π
G a i n ,
d B
M10.17
18
8π=ω p ,
18
12π=ω s ,
18
10π=ωc ,
18
4π=ω∆
wp = 4*(2*pi)/18;
ws = 6*(2*pi)/18;
wc = (wp + ws)/2;
dw = ws - wp;
% Hamming
M = ceil(3.32*pi/dw);
N = 2*M;
b = fir1(N, ws/(2*pi));
Not for sale 369
8/12/2019 Chapter10 SM
http://slidepdf.com/reader/full/chapter10-sm 47/64
[H, w] = freqz(b,1,512);
figure(1);
stem(b);
title('Impulse Response Coefficients');
xlabel('Time index n');ylabel('h[n]');
figure(2);
plot(w/pi, 20*log10(abs(H)));grid;xlabel('\omega/\pi');ylabel('Gain, dB');
title('Lowpass filter designed using Hamming window');
axis([0 1 -80 10]);
% Hann
M = ceil(3.11*pi/dw);
N = 2*M;
b = fir1(N, ws/(2*pi), hanning(N+1));
[H, w] = freqz(b,1,512);
figure(3);
stem(b);
title('Impulse Response Coefficients');xlabel('Time index n');ylabel('h[n]');
figure(4);
plot(w/pi, 20*log10(abs(H)));grid;
xlabel('\omega/\pi');ylabel('Gain, dB');
title('Lowpass filter designed using Hann window');
axis([0 1 -80 10]);
% Blackman
M = ceil(5.56*pi/dw);
N = 2*M;
b = fir1(N, ws/(2*pi), blackman(N+1));
[H, w] = freqz(b,1,512);
figure(5);
stem(b);
title('Impulse Response Coefficients');
xlabel('Time index n');ylabel('h[n]');
figure(6);
plot(w/pi, 20*log10(abs(H)));
grid;
xlabel('\omega/\pi');ylabel('Gain, dB');
title('Lowpass filter designed using Blackman window');
axis([0 1 -80 10]);
% Kaiser
beta = 3.631;
N = 44;
b = fir1(N, ws/(2*pi), kaiser(N+1, beta));
[H, w] = freqz(b,1,512);
figure(7);
stem(b);
title('Impulse Response Coefficients');
Not for sale 370
8/12/2019 Chapter10 SM
http://slidepdf.com/reader/full/chapter10-sm 48/64
xlabel('Time index n');ylabel('h[n]');
figure(8);
plot(w/pi, 20*log10(abs(H)));grid;
xlabel('\omega/\pi');ylabel('Gain, dB');
title('Lowpass filter designed using Kaiser window');
axis([0 1 -80 10]);
(a) Hamming window using fir1
0 5 10 15 20 25 30-0.1
0
0.1
0.2
0.3
0.4Impulse Response Coefficients
Time index n
n
0 0.2 0.4 0.6 0.8 1-80
-60
-40
-20
0
ω / π
G a i n ,
d B
Lowpass filter designed using Hamming window
(b) Hann window using fir1
0 5 10 15 20 25-0.1
0
0.1
0.2
0.3
0.4Impulse Response Coefficients
Time index n
n
0 0.2 0.4 0.6 0.8 1-80
-60
-40
-20
0
ω / π
G a i n ,
d B
Lowpass filter designed using Hann window
(c) Blackman window using fir1
0 10 20 30 40 50-0.1
0
0.1
0.2
0.3
0.4Impulse Response Coefficients
Time index n
n
0 0.2 0.4 0.6 0.8 1-80
-60
-40
-20
0
ω / π
G a i n ,
d B
Lowpass f ilter designed using Blackman window
(d) Kaiser window using fir1
Not for sale 371
8/12/2019 Chapter10 SM
http://slidepdf.com/reader/full/chapter10-sm 49/64
0 10 20 30 40-0.1
0
0.1
0.2
0.3
0.4Impulse Response Coefficients
Time index n
n
0 0.2 0.4 0.6 0.8 1
-80
-60
-40
-20
0
ω / π
G a i n
, d B
Lowpass filter designed using Kaiser window
M10.18 , ,π=ω 40. s π=ω 550. p 10.=α p dB, 42=α s dB, π=ω∆ 150. , π=ω 4750.c
(a) Hamming: use Eq. (10.33): 4622313322150
323==∴→=
π
π= M N M .
.
.
(b) Hann: 4222173320150113 ==∴→=ππ= M N M .
.
.
(c) Blackman: 7623806737150
565==∴→=
π
π= M N M .
.
.
(d) Kaiser: 00794010 20.
/ ==δ α− s s
% Hamming
N = 46;
b = fir1(N, 0.475, 'high');
[H,w] = freqz(b,1,512);
figure(1);
stem(b);
title('Impulse Response Coefficients');xlabel('Time index n');ylabel('h[n]');
figure(2);
plot(w/pi, 20*log10(abs(H)));grid;
xlabel('\omega/\pi');ylabel('Gain, dB');
title('Highpass filter designed using Hamming window');
axis([0 1 -80 10]);
% Hann
N = 42;
b = fir1(N, 0.475, 'high', hanning(N+1));
[H,w] = freqz(b,1,512);
figure(3);stem(b);
title('Impulse Response Coefficients');
xlabel('Time index n');ylabel('h[n]');
figure(4);
plot(w/pi, 20*log10(abs(H)));grid;
xlabel('\omega/\pi');ylabel('Gain, dB');
title('Highpass filter designed using Hann window');
axis([0 1 -80 10]);
Not for sale 372
8/12/2019 Chapter10 SM
http://slidepdf.com/reader/full/chapter10-sm 50/64
% Blackman
N = 76;
b = fir1(N, 0.475, 'high', blackman(N+1));
[H,w] = freqz(b,1,512);
figure(5);
stem(b);title('Impulse Response Coefficients');
xlabel('Time index n');ylabel('h[n]');
figure(6);
plot(w/pi, 20*log10(abs(H)));grid;
xlabel('\omega/\pi');ylabel('Gain, dB');
title('Highpass filter designed using Blackman window');
axis([0 1 -80 10]);
% Kaiser
ds = 0.00794;
[N,Wn,beta,type] = kaiserord([0.4 0.55],[1 0],[ds ds]);b = fir1(N, 0.475,'high',kaiser(N+1,beta));
[H,w] = freqz(b,1,512);
figure(7);
stem(b);
title('Impulse Response Coefficients');
xlabel('Time index n');ylabel('h[n]');
figure(8);
plot(w/pi, 20*log10(abs(H)));grid;
xlabel('\omega/\pi');ylabel('Gain, dB');
title('Highpass filter designed using Kaiser window');
axis([0 1 -80 10]);
(a) Hamming window using fir1
0 10 20 30 40-0.4
-0.2
0
0.2
0.4
0.6Impulse Response Coefficients
Time index n
n
0 0.2 0.4 0.6 0.8 1-80
-60
-40
-20
0
ω / π
G a i n ,
d B
Highpass filter designed using Hamming window
(b) Hann window using fir1
Not for sale 373
8/12/2019 Chapter10 SM
http://slidepdf.com/reader/full/chapter10-sm 51/64
0 10 20 30 40-0.4
-0.2
0
0.2
0.4
0.6Impulse Response Coefficients
Time index n
n
0 0.2 0.4 0.6 0.8 1
-80
-60
-40
-20
0
ω / π
G a i n
, d B
Highpass filter designed using Hann window
(c) Blackman window using fir1
0 20 40 60-0.4
-0.2
0
0.2
0.4
0.6Impulse Response Coefficients
Time index n
n
0 0.2 0.4 0.6 0.8 1
-80
-60
-40
-20
0
ω / π
G a i n ,
d B
Highpass filter designed using Blackman window
(d) Kaiser window using fir 1
0 5 10 15 20 25 30-0.4
-0.2
0
0.2
0.4
0.6
Impulse Response Coefficients
Time index n
n
0 0.2 0.4 0.6 0.8 1
-80
-60
-40
-20
0
ω / π
G a i n ,
d B
Highpass filter designed using Kaiser window
M10.19 , ,π ω 65.01 = p π ω 85.02 = p π ω 55.01 =s , π ω 75.02 =s , 2.0 pα dB, dB 42sα
π ωωω 1.0111 =s p∆ , ωπ ωωω ∆∆ =1.0222 s p
(a) Hamming window: 682342.331.0
32.3= M N M
π
π
(b) Hann: 642321.311.0
11.3= M N M
π
π
Not for sale 374
8/12/2019 Chapter10 SM
http://slidepdf.com/reader/full/chapter10-sm 52/64
(c) Blackman: 1122566.551.0
56.5= M N M
π
π
(d) Kaiser: ,00794.010 20 / = ss
αδ 97724.01020 /
= p
pα
δ
% Problem #M10.19
% Hamming
N = 68;
b = fir1(N, [0.6 0.8]);
[H, w] = freqz(b,1,512);
figure(1);
stem(b);
title('Impulse Response Coefficients');
xlabel('Time index n');ylabel('h[n]');
figure(2);
plot(w/pi, 20*log10(abs(H)));grid;
xlabel('\omega/\pi');ylabel('Gain, dB');
title('Bandpass filter designed using Hamming window');
axis([0 1 -80 10]);
% Hann
N = 64;
b = fir1(N, [0.6 0.8], hanning(N+1));
[H, w] = freqz(b,1,512);
figure(3);
stem(b);
title('Impulse Response Coefficients');
xlabel('Time index n');ylabel('h[n]');
figure(4);
plot(w/pi, 20*log10(abs(H)));grid;
xlabel('\omega/\pi');ylabel('Gain, dB');
title('Bandpass filter designed using Hann window');
axis([0 1 -80 10]);
% Blackman
N = 112;
b = fir1(N, [0.6 0.8], blackman(N+1));
[H, w] = freqz(b,1,512);
figure(5);
stem(b);
title('Impulse Response Coefficients');
xlabel('Time index n');ylabel('h[n]');
figure(6);
plot(w/pi, 20*log10(abs(H)));grid;xlabel('\omega/\pi');ylabel('Gain, dB');
title('Bandpass filter designed using Blackman window');
axis([0 1 -80 10]);
% Kaiser
[N, Wn, beta, type] = kaiserord([0.6 0.8], [1 0], [0.97724
0.00794]);
Not for sale 375
8/12/2019 Chapter10 SM
http://slidepdf.com/reader/full/chapter10-sm 53/64
b = fir1(2*N, [0.6 0.8], kaiser(2*N+1, beta));
[H, w] = freqz(b,1,512);
figure(7);
stem(b);
title('Impulse Response Coefficients');
xlabel('Time index n');ylabel('h[n]');
figure(8);
plot(w/pi, 20*log10(abs(H)));grid;
xlabel('\omega/\pi');ylabel('Gain, dB');
title('Bandpass filter designed using Kaiser window');
axis([0 1 -80 10]);
(a) Hamming window using fir1
0 10 20 30 40 50 60-0.2
-0.1
0
0.1
0.2
0.3Impulse Response Coefficients
Time index n
n
0 0.2 0.4 0.6 0.8 1-80
-60
-40
-20
0
ω / π
G a i n ,
d B
Bandpass filter designed using Hamming window
(b) Hann window using fir1
0 10 20 30 40 50 60-0.2
-0.1
0
0.1
0.2
0.3 Impulse Response Coefficients
Time index n
n
0 0.2 0.4 0.6 0.8 1-80
-60
-40
-20
0
ω / π
G a i n ,
d B
Bandpass filter designed using Hann window
(c) Blackman window using fir1
Not for sale 376
8/12/2019 Chapter10 SM
http://slidepdf.com/reader/full/chapter10-sm 54/64
0 20 40 60 80 100-0.2
-0.1
0
0.1
0.2Impulse Response Coefficients
Time index n
n
0 0.2 0.4 0.6 0.8 1-80
-60
-40
-20
0
ω / π
G a i n ,
d B
Bandpass filter designed using Blackman window
(d) Kaiser window using fir1
0 10 20 30 40-0.2
-0.1
0
0.1
0.2
0.3Impulse Response Coefficients
Time index n
n
0 0.2 0.4 0.6 0.8 1
-80
-60
-40
-20
0
ω / π
G a i n ,
d B
Bandpass filter designed using Kaiser window
M10.20 π π
ω 4286.070
152==c
% Problem #M10.20
N = 31;
d1 = fir1(N-1,0.4286);d2 = fir1(N-1,0.4286,'high');
[h1,w] = freqz(d1,1,512);h2 = freqz(d2,1,w);
plot(w/pi,20*log10(abs(h1)),'-r',w/pi,20*log10(abs(h2)),'--
b');grid;
xlabel('\omega/\pi');ylabel('Gain, dB');
title('Crossover pair');
axis([0 1 -80 10]);
0 0.2 0.4 0.6 0.8 1-80
-60
-40
-20
0
ω / π
G a i n ,
d B
Crossover pair
Not for sale 377
8/12/2019 Chapter10 SM
http://slidepdf.com/reader/full/chapter10-sm 55/64
M10.21 , 2494.01 =cω 5442.02 =cω
% Problem #M10.21
N = 32;
d1 = fir1(N, 0.2494, hanning(33));
d2 = fir1(N, 0.5442, 'high', hanning(33));d3 = -d1-d2;
d3(17) = 1-d1(17)-d2(17);
[h1,w] = freqz(d1,1,512);h2 = freqz(d2,1,w);h3 =
freqz(d3,1,w);
g1 = 20*log10(abs(h1))); g2 = 20*log10(abs(h2)));
g3 = 20*log10(abs(h3)));
plot(w/pi, g1,’—-b’,w/pi,g2,’-.g’,w/pi,g3,’-r’);grid;
xlabel('\omega/\pi');ylabel('Gain, dB');
title('Crossover triple');
axis([0 1 -80 10]);
0 0.2 0.4 0.6 0.8 1-80
-60
-40
-20
0
ω / π
G a i n ,
d B
Crossover triple
M10.22 % Problem #M10.22
fpts = [0 0.35 0.4 0.7 0.72 1];
mval = [0.2 0.2 1 1 0.6 0.6];
b = fir2(70, fpts, mval);
[H,w] = freqz(b,1,512);
figure(1);
plot(w/pi,abs(H));grid;
xlabel('\omega/\pi');ylabel('Magnitude');
title('Multilevel FIR filter');
axis([0 1 0 1.2]);
0 0.2 0.4 0.6 0.8 10
0.2
0.4
0.6
0.8
1
ω / π
M a g n i t u d e
Multilevel FIR filter
Not for sale 378
8/12/2019 Chapter10 SM
http://slidepdf.com/reader/full/chapter10-sm 56/64
M10.23 From Problem 10.36,
π=ω 450. p , ,π=ω 60. s 20430.=δ p , 04540.=δ s and we assume that
.2=T F Therefore, 4502
450 ..
=π⋅π= T
p F
F and ..60= s F
9851120 10 .log =δ−−=α p p dB, ( ) 8582620 10 .log =δ−=α s s dB.
After obtaining the length N using ‘remezord’, the specifications of the filter were not
met. We increased N to 11 to meet the specifications.% Program #M10.23
Ft = 2;Fp = 0.45;Fs = 0.6;
ds = 0.0454;dp = 0.2043;
F = [Fp Fs];A = [1 0];DEV = [dp ds];
[N,Fo,Ao,W] = remezord(F,A,DEV,Ft);
b = remez(N,Fo,Ao,W);
[H,w] = freqz(b,1,512);
figure(1);
plot(w/pi, 20*log10(abs(H)));
xlabel('\omega/\pi');ylabel('Gain, dB');title('N = 9');
%axis([0 0.45 -3 3]);
N = 11;
b = remez(N,Fo, Ao, W);
[H,w] = freqz(b,1,512);
figure(2);
plot(w/pi, 20*log10(abs(H)));
xlabel('\omega/\pi');ylabel(Gain, dB);title('N = 11');
Using remezord, we get N = 9. The corresponding gain response is shown in Figure (e) below:
0 0.2 0.4 0.6 0.8 1-80
-60
-40
-20
0
20
ω / π
G a i n ,
d B
N = 9
0 0.2 0.4 0.6 0.8 1-80
-60
-40
-20
0
20
ω / π
G a i n ,
d B
N = 11
(e) (f)
However, specifications are not met in the passband with this filter, so we increase N to11. The corresponding gain response is shown in Figure (f) above. The specifications
are now met.
Not for sale 379
8/12/2019 Chapter10 SM
http://slidepdf.com/reader/full/chapter10-sm 57/64
8/12/2019 Chapter10 SM
http://slidepdf.com/reader/full/chapter10-sm 58/64
( ) 4320 1101 =δ−=α s s log dB, ( ) 5420 2102 =δ−=α s s log dB.
% Program #M10.25
Ft = 2;Fp1 = 0.55;Fp2 = 0.7;Fs1 = 0.44;Fs2 = 0.82;
ds1 = 0.007;ds2 = 0.002;dp = 0.01;
F = [Fs1 Fp1 Fp2 Fs2];A = [0 1 0];DEV = [ds1 dp ds2];[N,Fo,Ao,W] = remezord(F,A,DEV,Ft);
b = remez(N,Fo,Ao,W);
[H, w] = freqz(b, 1, 512);
figure(1);
plot(w/pi,20*log10(abs(H)));grid;
xlabel('\omega/\pi');ylabel('Gain, dB');title('N = 39');
axis([0 1 -80 10]);
N = 41;
b = remez(N, Fo, Ao, W);
[H, w] = freqz(b, 1, 512);
figure(2);
plot(w/pi, 20*log10(abs(H)));
xlabel('\omega/\pi');ylabel('Gain, dB');title('N = 41');
axis([0 1 -80 10]);
Using remezord, we estimate the filter length to be N = 39. However, the minimumstopband attenuation specifications are not met in both stopbands, so we increase N to 41
0 0.2 0.4 0.6 0.8 1-80
-60
-40
-20
0
ω / π
G a i n ,
d B
N = 39
0 0.2 0.4 0.6 0.8 1
-80
-60
-40
-20
0
ω / π
G a i n ,
d B
N = 41
.
M10.26 % Program #M10.26 b = remez(29, [0 1], [0 pi], 'differentiator');
[H, w] = freqz(b, 1, 512);
plot(w/pi,abs(H));grid
xlabel('\omega/\pi');ylabel('Magnitude');
axis([0 1 0 pi]);
The magnitude response of the differentiator is given below:
Not for sale 381
8/12/2019 Chapter10 SM
http://slidepdf.com/reader/full/chapter10-sm 59/64
0 0.2 0.4 0.6 0.8 10
0.51
1.5
2
2.5
3
ω / π
M a g n i t u d e
M10.27 % Program #M10.27 f = [0.02 0.05 0.07 0.95 0.97 1];
m = [0 0 1 1 0 0];
wt = [1 60 1];
b = remez(30, f, m, wt, 'hilbert');
[H,w] = freqz(b,1,512);
plot(w/pi,abs(H));grid
xlabel('\omega/\pi');ylabel('Magnitude');
axis([0 1 0 1.2]);
The magnitude response of the Hilbert transformer is shown below:
0 0.2 0.4 0.6 0.8 10
0.2
0.4
0.6
0.8
1
ω / π
M a g n i t u d e
M10.28 , ,π=ω 350. p π=ω 50. s 1= p R dB, and 28= s R dB.
% Program #M10_28
% Design of a minimum-phase lowpass FIR filter
Wp = 0.35; Ws = 0.5; Rp = 1; Rs = 28;
% Desired ripple values of minimum-phase filter
dp = 1- 10^(-Rp/20); ds = 10^(-Rs/20);
% Compute ripple values of prototype linear-phase filter Ds = (ds*ds)/(2 - ds*ds);
Dp = (1 + Ds)*((dp + 1)*(dp + 1) - 1);
% Estimate filter order
[N,fpts,mag,wt] = remezord([Wp Ws], [1 0], [Dp Ds]);
% Design the prototype linear-phase filter H(z)
[b,err,res] = remez(N,fpts,mag,wt);
K = N/2;
b1 = b(1:K);
Not for sale 382
8/12/2019 Chapter10 SM
http://slidepdf.com/reader/full/chapter10-sm 60/64
% Design the linear-phase filter G(z)
lenerr= res.error(length(res.error));
c = [b1 (b(K+1) + lenerr)) fliplr(b1)]/(1+Ds);
zplane(c);title('Zeros of G(z)');pause
c1 = c(K+1:N+1);
[y, ssp, iter] = minphase(c1);
zplane(y);title(‘Zeros of the minimum-phase filter’); pause
[hh,w] = freqz(y,1, 512);
% Plot the gain response of the minimum-phase filter
plot(w/pi, 20*log10(abs(hh)));grid
xlabel('\omega/\pi');ylabel('Gain, dB');
-6 -4 -2 0
-2
-1
0
1
2
2 20
Real Part
I m a g i n a r y P a r t
Zeros of G(z)
-1.5 -1 -0.5 0 0.5 1 1.5
-1
-0.5
0
0.5
1
10
Real Part
m a g n a r y
a r
Zeros of the minimum-phase filter
0 0.2 0.4 0.6 0.8 1-80
-60
-40
-20
0
20
ω / π
G a i n ,
d B
M10.29 % Program #M10.29
c = [2.4 6.76 26.15 68.43 186.83 326.51 565.53 678.95 805.24
678.95 565.53 326.51 186.83 68.43 26.15 6.76 2.4];
h = firminphase(c)
The coefficients of the minimum phase spectral factor are:h = 7.6730 8.5329 18.0722 12.5696 12.6822 4.8388 2.0784 0.5332 0.3128
M10.30 % Program #M10.30
[h,g]=ifir(6,'low',[.1 .15],[.001 .001]);
[hh,w]=freqz(h,1,1024); hg=freqz(g,1,1024);
h = hh.*hg; % Compounded response
Fg = 20*log10(abs(hh)); Ig = 20*log10(abs(hg));
plot(w/pi,Fg,'-r',w/pi,Ig,'--b'); grid;
axis([0 1 -90 5]);
Not for sale 383
8/12/2019 Chapter10 SM
http://slidepdf.com/reader/full/chapter10-sm 61/64
legend('F(z^6)','I(z)');
xlabel('\omega/\pi');title('Gain responses, in dB');
pause;
plot(w/pi,20*log10(abs(h))); grid;
axis([0 1 -90 5]);
xlabel('\omega/\pi');title('Gain response, in dB');
gtext('H_{IFIR}(z)');
0 0.2 0.4 0.6 0.8 1
-80
-60
-40
-20
0
ω / π
Gain responses, in dB
F(z6)
I(z)
0 0.2 0.4 0.6 0.8 1
-80
-60
-40
-20
0
ω / π
Gain response, in dB
HIFIR
(z)
M10.31 % Program #M10.31 [h,g]=ifir(6,'high',[.9 .95],[.002 .004]);
[hh,w]=freqz(h,1,1024); hg=freqz(g,1,1024);
h = hh.*hg; % Compounded response
Fg = 20*log10(abs(hh)); Ig = 20*log10(abs(hg));
plot(w/pi,Fg,'-r',w/pi,Ig,'--b'); grid;
axis([0 1 -90 5]);legend('F(z^6)','I(z)');
xlabel('\omega/\pi');title('Gain responses, in dB');
pause;
plot(w/pi,20*log10(abs(h))); grid;
axis([0 1 -90 5]);
xlabel('\omega/\pi');title('Gain response, in dB');
gtext('H_{IFIR}(z)');
0 0.2 0.4 0.6 0.8 1
-80
-60
-40
-20
0
ω / π
Gain responses, in dB
F(z
6
)I(z)
0 0.2 0.4 0.6 0.8 1
-80
-60
-40
-20
0
ω / π
Gain response, in dB
HIFIR
(z)
Not for sale 384
8/12/2019 Chapter10 SM
http://slidepdf.com/reader/full/chapter10-sm 62/64
M10.32 % Problem #M10.32 InpN = ceil(2*pi/(0.15*pi));
% Plotting function
% plots the result of using an equalizer of length InpN
%function [N] = plotfunc(InpN);
% Creating filters
Wfilt = ones(1, InpN);
Efilt = remezfunc(InpN, Wfilt);
% Plot running sum filter response
figure(1);
Wfilt = Wfilt/sum(Wfilt);
[hh, w] = freqz(Wfilt, 1, 512);
plot(w/pi, 20*log10(abs(hh)));
axis([0 1 -50 5]);grid;
xlabel('\omega/\pi');ylabel('Gain, dB');
title('Prefilter H(z)');
% Plot equalizer filter response
figure(2);
[hw, w] = freqz(Efilt, 1, 512);
plot(w/pi, 20*log10(abs(hw)));
axis([0 1 -50 5]);grid;
xlabel('\omega/\pi');ylabel('Gain, dB');
title('Equalizer F(z)');
% Plot cascade filter response
figure(3);
Cfilt = conv(Wfilt, Efilt);
[hc, w] = freqz(Cfilt, 1, 512);
plot(w/pi, 20*log10(abs(hc)));
axis([0 1 -80 5]);grid;
xlabel('\omega/\pi');ylabel('Gain, dB');
title('Cascade filter H(z)F(z)');
% Remez function using 1/P(z) as desired amplitude
% and P(z) as weighting function [N] = remezfunc(Nin, Wfilt);
% Nin : number of tuples in the remez equalizer filter
% Wfilt : the prefilter
a = [0:0.001:0.999]; % The accuracy of the computation
w = a.*pi;wp = 0.05*pi;ws = 0.15*pi;
i = 1;n = 1;
for t = 1:(length(a)/2),
Not for sale 385
8/12/2019 Chapter10 SM
http://slidepdf.com/reader/full/chapter10-sm 63/64
if w(2*t) < wp
pas(i) = w(2*t - 1);
pas(i+1) = w(2*t);
i = i+2;
end
if w(2*t-1) > ws
sto(n) = w(2*t - 1);sto(n+1) = w(2*t);
n = n+2;
end
end
w = cat(2, pas, sto);
bi = length(w)/2;
for t1 = 1:bi,
bw(t1) = (w(2*t1) + w(2*t1-1))/2;
W(t1) = Weight(bw(t1), Wfilt, ws);
end
W = W/max(W);
for t2 = 1:length(w),G(t2) = Hdr(w(t2), Wfilt, wp);
end
G = G/max(G);
N = remez(Nin, w/pi, G, W);
% Weighting function
function[Wout] = Weight(w, Wfilt, ws);
K = 22.8;
L = length(Wfilt);
Wtemp = 0;
Wsum = 0;
for k = 1:L, Wtemp = Wfilt(k)*exp((k-1)*i*w);
Wsum = Wsum + Wtemp;
end
Wout = abs(Wsum);
if w > ws,
Wout = K*max(Wout);
end
% Desired function
function [Wout] = Hdr(w, Wfilt, ws);
if w <= ws,
L = length(Wfilt); Wtemp = 0;
Wsum = 0;
for k = 1:L,
Wtemp = Wfilt(k)*exp(i*(k-1)*w);
Wsum = Wsum + Wtemp;
end
Wsum = abs(Wsum);
Wout = 1/Wsum;
Not for sale 386
8/12/2019 Chapter10 SM
http://slidepdf.com/reader/full/chapter10-sm 64/64
else
Wout = 0;
end
0 0.2 0.4 0.6 0.8 1-50
-40
-30
-20
-10
0
ω / π
G a i n ,
d B
Prefilter H(z)
0 0.2 0.4 0.6 0.8 1
-50
-40
-30
-20
-10
0
ω / π
G a i n ,
d B
Equalizer F(z)
0 0.2 0.4 0.6 0.8 1-80
-60
-40
-20
0
ω / π
G a i n ,
d B
Cascade filter H(z)F(z)