02.10.2019 Views

UploadFile_6417

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

372 Chapter 7 FIR FILTER DESIGN<br />

Solution<br />

The following MATLAB script describes the design procedure.<br />

>> w1 = 0; w2 = 0.3*pi; delta1 = 0.01;<br />

>> w3 = 0.4*pi; w4 = 0.7*pi; delta2 = 0.005;<br />

>> w5 = 0.8*pi; w6 = pi; delta3 = 0.001;<br />

>> weights = [delta3/delta1 delta3/delta2 1];<br />

>> Dw = min((w3-w2), (w5-w3));<br />

>> M = ceil((-20*log10((delta1*delta2*delta3)^(1/3))-13)/(2.285*Dw)+1)<br />

>> M = 51<br />

>> f = [0 w2/pi w3/pi w4/pi w5/pi 1];<br />

>> m = [1 1 0.5 0.5 0 0];<br />

>> h = firpm(M-1,f,m,weights);<br />

>> [db,mag,pha,grd,w] = freqz_m(h,[1]);<br />

>> delta_w = 2*pi/1000;<br />

>> w1i=floor(w1/delta_w)+1; w2i = floor(w2/delta_w)+1;<br />

>> w3i=floor(w3/delta_w)+1; w4i = floor(w4/delta_w)+1;<br />

>> w5i=floor(w5/delta_w)+1; w6i = floor(w6/delta_w)+1;<br />

>> Asd = -max(db(w5i:w6i))<br />

Asd = 62.0745<br />

>> M = M-1; h = firpm(M-1,f,m,weights);<br />

>> [db,mag,pha,grd,w] = freqz_m(h,[1]);<br />

>> Asd = -max(db(w5i:w6i))<br />

Asd = 60.0299<br />

>> M = M-1; h = firpm(M-1,f,m,weights);<br />

>> [db,mag,pha,grd,w] = freqz_m(h,[1]);<br />

>> Asd = -max(db(w5i:w6i))<br />

Asd = 60.6068<br />

>> M<br />

M = 49<br />

The time- and the frequency-domain plots of the designed filter are shown in<br />

Figure 7.38.<br />

□<br />

□ EXAMPLE 7.27 In this example we will design a digital differentiator with different slopes in<br />

each band. The specifications are<br />

Band-1:<br />

0 ≤ ω ≤ 0.2π, Slope = 1 sam/cycle<br />

Band-2: 0.4π ≤ ω ≤ 0.6π, Slope = 2 sam/cycle<br />

Band-3: 0.8π ≤ ω ≤ π,<br />

Slope = 3 sam/cycle<br />

Solution<br />

We need desired magnitude response values in each band. These can be obtained<br />

by multiplying band-edge frequencies in cycles/sam by the slope values<br />

in sam/cycle<br />

Copyright 2010 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).<br />

Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!