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.

Window Design Techniques 333<br />

To display the frequency-domain plots of digital filters, MATLAB<br />

provides the freqz function, which we used in earlier chapters. Using this<br />

function, we have developed a modified version, called freqz m, which<br />

returns the magnitude response in absolute as well as in relative dB scale,<br />

the phase response, and the group delay response. We will need the group<br />

delay response in the next chapter.<br />

function [db,mag,pha,grd,w] = freqz_m(b,a);<br />

% Modified version of freqz subroutine<br />

% ------------------------------------<br />

% [db,mag,pha,grd,w] = freqz_m(b,a);<br />

% db = Relative magnitude in dB computed over 0 to pi radians<br />

% mag = absolute magnitude computed over 0 to pi radians<br />

% pha = Phase response in radians over 0 to pi radians<br />

% grd = Group delay over 0 to pi radians<br />

% w = 501 frequency samples between 0 to pi radians<br />

% b = numerator polynomial of H(z) (for FIR: b=h)<br />

% a = denominator polynomial of H(z) (for FIR: a=[1])<br />

%<br />

[H,w] = freqz(b,a,1000,’whole’);<br />

H = (H(1:1:501))’; w = (w(1:1:501))’;<br />

mag = abs(H); db = 20*log10((mag+eps)/max(mag));<br />

pha = angle(H); grd = grpdelay(b,a,w);<br />

7.3.8 DESIGN EXAMPLES<br />

We now provide several examples of FIR filter design using window techniques<br />

and MATLAB functions.<br />

□ EXAMPLE 7.8 Design a digital FIR lowpass filter with the following specifications:<br />

ω p =0.2π,<br />

ω s =0.3π,<br />

R p =0.25 dB<br />

A s =50dB<br />

Choose an appropriate window function from Table 7.1. Determine the impulse<br />

response and provide a plot of the frequency response of the designed filter.<br />

Solution<br />

Both the Hamming and Blackman windows can provide attenuation of more<br />

than 50 dB. Let us choose the Hamming window, which provides the smaller<br />

transition band and hence has the smaller order. Although we do not use the<br />

passband ripple value of R p =0.25 dB in the design, we will have to check<br />

the actual ripple from the design and verify that it is indeed within the given<br />

tolerance. The design steps are given in the following MATLAB script.<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!