DSP Textbook Scan
DSP Textbook Scan
DSP Textbook Scan
-
3)+3o(n-4) 26tn -5) +8(n-6)
hm)=(1. 3,-2, 2. 3. 1) hn)=(1, 2,3, 4,3, 2, 1)
Case ( : N odd and hn) - -HN- I - )
Also, we are given
With N 7 .
wehave hn)=1,3,-2.0. 2. -3,-1) H(o)-05e
Case (iv): N even and hn) = -h{N-l - n). H)-0.5:
With N 6, we have z-transforn on both the sides, we get
Taking nverse
hm)= (1. 3. -2, 2, -3.-1) h (m)=(0.5)" u(n)
Exomple 5.6 Youare given two caiisalfilters whose frequency respornses are Given H(0)=H (w)» H,(a)
H 05e
Hence. hn)= h(n)h(n)
H2(@)= sin 0.50 to time-domain mulüplication)
(Since, frequency-domain convolution is equivalent
H)-16 16
Copute the coeficients of hn), where hn) is the inverse DIFT of H)
below using the window
Example 5.7 Obtain the coefticients of an FlR ilter to meet the specitications given
Solution:
method.
Given H(w)=| jl.Sw Stopband edge frequency: 2 KHz
sin 0.50 Passband edge frequency: 15 KHz
t wrle Minimum stopband attenuation: 50 dB Sampling frequency: 8 a
352 Design of FIR Filters
Digital Signal Processing
Solution: joa < @c
We are
required Then, Ha(o)=
to design a
linear-phase FIR filter H(z) to be used in the A/D H() -
D/A structure shown 0, c <ol<r
in
Fig. Ex.5.7 so that the cascade combination behaves like an equivalent analog filter having the following
specifications. |HAo) o)
p =27x1.5x10 rad/sec
27x2x10 rad/ sec WC
Ks =-As=-50dB
Fig. Ex.5.7(o): Magnitude response of the desired Flg. Ex.5.7(b) Phase response of the desired
Heals) lowpass filter lowpass fiter
x{)- A/D DIA {) Step 4: To find the impulse response, hA)
Fig. Ex.5.7: Equivalent analog flter.
--
ha)Ho)e/mdo
Converting the above analog specifications into equivalent digital specifcations using the formula, o = 2T with
joa jun do
T 8x103 We get
p =2pT=4xI.Sx10
8x103 Sinl@c(n-a)] na
z(n-a)
= 0.375T rad
Os2T4Tx2x103
8x103 Also,
= 0.57 rad
Step 5:
Step 1: Table 5.l indicates that the Hamming or Blackman window will satisfy the stopband attenuation requirement.
Hamming window is selected since it has a lower transition width than the Blackman window and thus Select oc 0p+
giving the smallest value of N. (0.ST-0.375T)
= 0.3757 +
Step 2: The length of window is computed using the expression 2
=0.4375x rad
-2
Also, select
Since, k= 4 for the Hamming window, we get
65-32
0.5T-0.375m2
Step 6: Finally, the impulse response h(n) of the FIR filter is
8
N20.5t-0.375n h(n) =ha(n) wHam(). 0gngN-1
N2 64
where
WHamn)=0.54-0.46cos 0SngN-1
N-1s an integer.
Let N 65, so that a =i
2
MHam(n)=0.54-0.46cos ogn s64
64
Step 3: Let the magnitude and phase responses of the desired lowpass filter be as shown in
Fig. Ex.5.7(a) and Fie. Ex.5.7(6) respectively.
Digital Signal Processing
Design of FIR Fliers
r coeficients are computed and tabulated as follows: 355
37 0.0354 0.9457 0.03348
hAn)
Ham) h{m) =hAn)wHam ) 38 0.049 0.9225 0.0452
-2.984x 10-15 0.0800 -2.387 x 10-16 39 .0088 0.8956 -7.881x 10-3
-0.01 0.0822 -8.22 x 10 40 -0.0398 0.8653 -0.0344
-0.004 0.0888 -3.55 x 104 41 0.0069 0.8318 -5.739 x 10-3
0.009 0.0998 8.982 x 104 42 0.0294 0.7955 0.0234
0.008 0.1150 43 0.016
9.2 x 104 .7568 0.0121
0.0065 0.1343 8.729 x 104 44 -0.0187 0.7160 0.03134
-0.0113 0.1575 -1.779 x 10-3 45 -0.020 0.6735 0.01347
0.00248 0.1844 4.573 x 10 46 0.0087 0.6297 54783x 10-15
0.01326 0.2147 2.8469 x 103 7 0.0208 0.5851 0.01217
9 0.0027 0.2482 6.7014 x 104 48 3.9788x 10-15 0.5400 2.1485x 10-15
10 0.0134 0.2844 3.81 x 10-3 19 -0.01836 .4949 -9.086x 10-3
1 -0.0084 50
0.3232 -2.714 x 103 -0.00677 0.4502 3.047x 10-3
12 0.01125 51
0.3639 4.0938x 103 0.01393 0.4065 5.6625x 10-3
13 0.013 52 0.01125 0.3639 4.0938 x 10
0.4065 5.6625x 10-3
4 -0.00677 53 0.0084 -2.714x 10-3
4502 -3.047x 10 0.3232
I5 0.01836 54 -0.0134 3.81 x 10
0.4949 -9.086 x 10-3 0.2844
6 3.9788 x 10-15 55 0.0027 0.2482 6.7014 104
0. 5400 2.1485x 10-15
17 0.0208 0.01326 0.2147 2.8469x 103
0.5851 0.01217
18 0.0087 57 0.00248 0. 1844 4.573 x 10
0.6297 5.4783x 10-3
19 0.020 58 -0.0113 0.11575 -1.779 x 103
0.6735 0.01347
20 0.0187 0.7160 59 -0.0065 0.1343 8.729 x 10
0.0134
21 0.016 7568 60 0.008 0.1150 9.2x 104
0.0121
22 0.0294 .7955 61 0.009 0.0998 8.982x 104
0.0234
23 -0.0069 0.8318 -5.739 x 103 62 0.004 0.0888 -3.55 x 10
24 -0.0398 0.8653 63 -0.01 0.0822 -8.22x 104
25 0.0088
-0.0344 64 -2.984 x 10-15 -2.387 x 10-16
0.8956 -7.881 x 10 0.0800
26 0.049 0.9225 0.0452
0.0354 0.9457 Example 5.8Fig Ex 58shows the impulse response of an analog filter.
0.03348
28 0.056 0.9650 0.054 Aet hn hnD, where T I sec, be the
29 0.0882 0.9802 impulse response of a discrete-time FIR filter.
0.0864
30 0.0609 0.9911 0.0604 FindH) and H(@) for this filter.
0.3122 bRoughlysketch H(@. 10
0.9978 0.3115 Fig. Ex.5.8: Analog impulse response
0.4375 1
33 0.4375 Solution:
0.3122 0.9978 0.3115 The time-domain expression for the impulse response of the given analog filter is
34 0.0609 0.9911 0.0604
35 -0.0882 0.9802 -0.0864
36 -0.056 10-4, 5<ts10
0.9650 0.054
Hence, h(n) = h,(nT)
356 Design of FIR Flters
Digital Signal Processing
nT. 0nT5 BxampleS.9 EWe wish to design an FIR bandpassfilter having aduration N 7 HTO)
10-T, 6snT <10 characteristic of the non causat bandruss titeg, thesane jsshownin Fig Exs9
Determine n)comesponding toHO
Since T I sec, we get
hn)=
0SnS5 Explain howwould you use the ltamuhing window
10-n, 6SnS10 Nacam-0.54+0466os 20
h(m)= (0.1,2,3,4, 5, 4,3, 2,1,0)
o design an EIR bandpassflter havi
Hencc, H)-n" n=0
=0++27+3+4 +5z- +4+3-+2++0 e rad oc I nad r
Since, the length of the impulse response h(m) is odd and it is center symmetric, the frequency
is given by response H(0)
-3) maghtude response
H(w)= 2h(cos Solution:
For a bandpass filter, the desired firequency response is
H(w) =
0, otherwise
=e"
((5) +2h(0)cos Sw+ 2h()cos 4w+ 2h(2)cos 3w 2h3)cos 2w+ 2h(4)cos w)
w)= e Io(5 +0+ 2cos 4o+ 4cos 3w+6cos 2w+8cos w)
where a 2
The filter coeticients are
given by
-
H H) ei-a)do+en-a}»dw
0 25 04x -a
0.lx 20.3 0.6x
0.2x 10.5
0.3x 2.4
0.8x
sin(n
r(n-a)
-co,-sin|n-a)o,). n*a
The magnitude response is shown in Fig. Ex.5.8(a). and AyUn)c-o,) n=a
25 For N= 7, oC I rad, o * 2 rad and a= 3, we get
20+ h (0)=h(6)=-0.04462
15+ h()=h,(5)=-0.26517
ha(2)=h(4)=0.02159
10t h(3)=0.31831
The non-causal Hamming window function is given in the problem as
0.27 04 0.6 0.8 Hamn)=0.54 +0.46cos 3ng3
Fig. Ex.5.8(o): Magnihude response. We would like to remind the reader that, the above formula s for a non-causal hamming window.
I
Digital Signal Processing Design of FIR Filters
-2 359
O.08 0.31 0.77
WHam ) 0.77 20 log lHeo2)
0.31 0.08 dB
Toget a causal window sequence, change n
>n-3). This leads to the following table Np
0 *S2 ad/sec
Kp
WHam 0.08 0.31 0.77
6
0.77 0.31 0.08
Hence, h{n) =
h{n) wHam n), 0 ng6.
The table below gives the values of
h(n) for N=7.
Ks
hd(n) WHam
-0.4462
h(m)= hAm)WHam ) Fig. Ex.5.10(b): Magnitude response of the equivalent analog fiter.
0.08 0.0035696
0.26517
Converting the above analog specifications into digital specifications using the formula, @ 2T with
0.31 =
0.0822027 T= 0 x 1 0 3 secs, we get
0.02159 0.77 0.0166243
0.31831
0.31831 Op 2pT =27 x10x10 x =0.47
0.02159 0.77 0.0166243
0.26517 0.31 -0.0822027 os =
%T =27x15x10 x =
50x103 0.6
-0.04462 0.08
0.0035696 The stopband attenuation As= 50 dB remains unchanged.
Exemple 5:10 An analog signal Step 1:
containsfrequehicies upto 10 KHz This signal is sampled at
50KHz. Design an FIR filter having a linearphase characteristic and transition band of a Type Transition width (rad) Minimum Stopband attenuation (dB)
5 KHz The flter should provide
minimum 50 dB attemuation át theë end of transition band. 47
Rectangular 21
Solution: N
The specifications given in the problem are with respect to the equivalent analog filter shown in Bartlett
N
25
Fig. Ex.5.10(a). We are required to design the
digital filter having the system function H(), so that the equivalent
analog filter having the transfer function meets the 87t
Hegls)requirements specified in the problem. Hanning A
N
************--
Ho) Hamming
N
53
x(/)- AD DA 127t
Blackman 4
N
--- ******* ************************************-****-*********************** .*
Fig.Ex.5.10(a): Equlvalent analog fHer, Heq). Referring the table given above, we find that to get a stopband attenuation of 50 dB or more, we could select
either Hamming window or Blackman window. Our choice is Hamming window because it has a lower transition
Fig. Ex.5.106) shows the frequency response of the equivalent analog filter having the transfer function width than the Blackman window.
Hes). Step 2: The number of points in the window is selected using the equation
We are given the following specifications of the magnitude response shown in
Fig. Ex.5.10(b): s -@p 2k2n
N
ap = 2Tx10x10* rad/sec
where k 4 for the Hamming window.
2tx (10+5)x10 =27 x15x10 rad/sec
Hence, 0.67-0.47 2
Ks = -50dB or As =50dB
N2 40
360
Digital Signa Proce:zing Deign of FIR Filters
Let us select N to N-1 The FIR filter coefficients are computed and tabulated as follows:
be 41 so that a =
is an
integer.
Step 3: Let the
2 hAn) WHa) h(n)= han)wHam)
magnitude and phase responses of the desired lowpass filter be as shown in
Fig Ex.5.10(c) and Fig. 0.08
Ex.5.10(d).
Referring these figures, we can write 0.017 0.086 0.001462
0.1 0
e 0.00247
Hao)= 0.019 0.13
0, Oc<o<T 0 .168 0
0.021 0215 0.004515
0.27
O(») 0.00792
0.024 0.33
0.40
C
C @C 0C
-0.029 0.47 0.01363
10 0 0.54 0
0.035 0.61 0.02135
Fig. Ex.5.10 (c): Mogntude response 12 0 0.68 0
Flg. Ex.5.10 (d): Phase response
Step 4: The
impulse response of the desircd 13 0.045 0.75 -0.03375
of HA). lowpass filter is found by taking the inverse DIFT 14 0 0.81 0
0.064 0.86 0.05504
ha(n)- 21 e/o jomdo =Snlac(n-a)) 6 0.91 0
T(n -a) 17 .106 0.95 0.1007
and 18 0 0.98 0
ha(a)= 9 0.318 0.99 0.3148
0 0.5
Step 5: 0.5
21 0.318 0.99
Select 0.3148
Wc p + 0 0.98 0
0.106 0.95 0.1007
=
0.4T 0.27 =0.57 rad 0 0.91 0
2 25 0.064 0.86 0.05504
Also select 26 0.81
a -1 241-l-20 27
0
0.045 0.75 -0.03375
28 0
Step 6: 0.68
Finally, the impulse response of the FIR filter is 29 0.035 0.61 0.02135
30 0.54
hm)=ha(n) Ham (), 0nSN-1 0
-0.029 0.47 -0.01363
where 32 0 0.40
wHam(n)=0.54-0.46cos n<N-I 33 0.024 0.33 0.00792
Thus, the impulse 34
0.27
response of the FIR filter for 0 n 40 is 35
0
0.021 0.215
36
-0.004515
0.168
sin 0.57(n20)0.54-0.46cos I:n*20 37 0.019 0.13
0
38
0.00247
0
h(n)= 10
39 -0.017 0.086
0.54-046 cos2T n 20 0
0.001462
L
40 0.080 0
Digital Signal Processing Design of FIR Filters
363
Fig. Fix.5.Il shows the frequenc response of an ideal lowpass filter.
s.11 b. The impulse responsc of the FIR filter is
. Find h) hat gives this ideal freúency response.
h(n) =ha(n) Ham(n), 0gnSN-1
b. Suppose thathan) 1s multiplied by a Hamming window, what is
Roughly sketch the frequency hny?
values response for
of GHtofT frequeicy, transitiön widthhn), designed part (b). Be sure to give the
in
where
lam (n) 0.54 -046cos
0N-1 0nSN-1
gnd stopband altenuation. N=
Since a= we get
4-1
N=9
2
Thus, Ham (n)=0.54-046cos 0Sn<8
The table below shows the computations of hAn), wHamn) and h{n) for 0 S n s8.
(yLH (0
h{n) = hAn)WHam")
dn) WHam)
0.08
0.075 0.2147 0.161
159 0.54 0.0858
0.225 0.8652 0.1946
0.25 0.25
0.225 0.8652 0.1946
Hg.Ex.5.1 1: Freqvency response of an ideal lowpass filter
0.159 0.54 0.0858
Solution: 0.075 0.2147 0.161
a. Refer Fig. Ex.5.1l, we can write 0.08
A rough magnitude response of the FIR filer designed using Hamming window is shown in Fig
Ha(o) = |Hg(w)es0(o) Ex.5.11(a).
| 20 log H(
e jo = erj40,
-0P
otherwise
c0p*2
--F
K
The impulse response of the ideal lowpass filter is found as follows: 8 53 dB
h,(n) 277
H,(o) e/ondo
ei4agj0n do =sinn-4) T(n-4)
n4
4 Fig. Ex.5.11(o): Rough magntude response ofthe FiR fier
Fid the iipuse respohse hn) of AliedY pbae FR ltieof tehw# 4tor which the frqueny
reSponse SE at o =
0 and )= is specified as
gnr t,
Also, hu14) do=*2- =0.25 d
1 0 ) l and H,
Digllal Signal Processing Dosign of FIR Füters 365
364
The ripple level is first expressed as an attenuation in decibels:
Solution:
Since N is even and h{n) is center symmetric, we have A-20log 6
where, 6 min 1op, og)
H,(o)=2n)cos|ol
The parameter p is now found using the emperical formulae
n=0 B 0.11024A-8.7), if A> 50dB
- 2h(n)cos|o(n-1.5)) B-0.5842A-214 0.078AA -21), if 21< A< 50dB
n=0
B-0, if A<21
H,(o)=2h(0)cos(1.50)+ 2h()cos(0.50)
Note that is zero for an attenuation of 21 dB. This corresponds to a rectangular window, which produces
Given H0)-1
ripples around -21 dB. This is in agreement with Fig 5.7(c).
Hence 12h(0)+2h(1)
Given the values of Aand the transition width af = , N is found using the formula:
Also,
N> 4-7.95
14.364
Hence -1.414h(0)+1414h(1)=
This generally gives a fractional resut, so N is rounded-off to the nearest odd intege
Solving, we get
h(0)=0.0732 We finally, substitute the value of f and a= in the impulse response m) of the window. The functi
and hl) =0.4268 lolr) may be expanded as a power series:
Since, the FIR filter has linear-phase,
hn)=h(N-1-n). 0<n<N-I
The cocthcients of the FIR filter are tabulated below:
The series normally converges satisfactorily if more than about ten terms are included.
n
0 2
h(m) 0.0732 0.4268 0.4268 0.0732 Example 5.13
Design a lowpassfiliter with a cutoff freguency oc transition width, Ao 0.02xand
Kaiser window stopband ripple,. 8 0.01 Ue Kaiserwindow
The windows that we have studied till now had fixed shapes. Each window offers a particular trade Solution:
off between the width of the main spectral lobe and sidelobe levels. The prime j contribution of
Express the stopband ripple in dB.
J.E. Kaiser in the area of FIR filter design using windows was to suggest a function, in which the trade-off can be
adjusted by the designer. That is, A- -20 log s- 40 dB
The Kaiser window function is defined
as For A 40 dB,the6 is selected as follows:
B-0.5842(A-2104 +0.07886(4-21)
n)=
B=0.5842(40-210-4 +0.07886(40-21)
0SnN- 3.4
0, elsewhere af A_0.02 = 0.01
where lolx) is the Bessel function of the first kind and of zero-order. The value of controls the
f degree of
Also, 2 2
taper towards the edge of the window. If f = 0, there is no taper and we get a rectangular window; if f 5.44, the The length of the window:
window is similar to Hamming function. Other values of f offer the >A-7.95
designer a whole range of trade-off between N
main-lobe width and sidelobe performance. Also, in the expression for w{n), the parameter or a= N-1 determincs 14.364
the size of the window (N). The design of Kaiser window is given below N2 223.189