02.10.2019 Views

UploadFile_6417

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

FIR Filter Designs for Sampling Rate Conversion 503<br />

1.5<br />

Impulse Response<br />

Log–magnitude Response<br />

1<br />

0<br />

Amplitude<br />

0.5<br />

0<br />

Decibels<br />

−30<br />

−0.5<br />

0 10 20 30<br />

n<br />

Amplitude Response<br />

−50<br />

0 0.2 0.32 1<br />

Frequency in π units<br />

Scaled Ripples<br />

5<br />

0.03<br />

0.16<br />

Amplitude<br />

Amplitude<br />

0<br />

0<br />

0<br />

−0.03<br />

−0.16<br />

0 0.2 0.32 1<br />

0 0.2 0.32 1<br />

Frequency in π units<br />

Frequency in π units<br />

FIGURE 9.20 Responses of the FIR interpolation filter in Example 9.8<br />

Solution<br />

The steps are given in the following MATLAB script.<br />

% Given Parameters:<br />

I = 5; Rp = 0.1; As = 30; wp = pi/I; ws = 0.32*pi;<br />

[delta1,delta2] = db2delta(Rp,As); weights = [delta2/delta1,1];<br />

n = [0:50]; x = cos(0.5*pi*n);<br />

n1 = n(1:17); x1 = x(17:33); % for plotting purposes<br />

% Input signal<br />

Hf1 = figure(’units’,’inches’,’position’,[1,1,6,4],...<br />

’paperunits’,’inches’,’paperposition’,[0,0,6,4]);<br />

subplot(2,2,1); Hs1 = stem(n1,x1,’filled’); set(Hs1,’markersize’,2,’color’,’g’);<br />

set(gca,’xtick’,[0:4:16],’ytick’,[-1,0,1]);<br />

axis([-1,17,-1.2,1.2]); ylabel(’Amplitude’); xlabel(’n’,’vertical’,’middle’);<br />

Title(’Input Signal x(n)’,’fontsize’,TF);<br />

% Interpolation with Filter Design: Length M = 31<br />

M = 31; F = [0,wp,ws,pi]/pi; A = [I,I,0,0];<br />

h = firpm(M-1,F,A,weights); y = upfirdn(x,h,I);<br />

delay = (M-1)/2; % Delay imparted by the filter<br />

m = delay+1:1:50*I+delay+1; y = y(m); m = 1:81; y = y(81:161); % for plotting<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!