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.

Sampling Rate Conversion by a Rational Factor I/D 497<br />

The length of the FIR filter h that resample uses is proportional to<br />

the fourth (optional) parameter L that has the default value of 10. For<br />

L = 0, resample performs a nearest-neighbor interpolation. The fifth optional<br />

parameter beta (default value 5) can be used to specify the Kaiser<br />

window stopband attenuation parameter β. The filter characteristics can<br />

be studied using the impulse response h.<br />

□ EXAMPLE 9.6 Consider the sequence x(n) =cos(0.125πn) discussed in Example 9.2. Change<br />

its sampling rate by 3/2, 3/4, and 5/8.<br />

Solution<br />

The following MATLAB script shows the details.<br />

n = 0:2048; k1 = 256; k2 = k1+32; m = 0:(k2-k1);<br />

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

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

% (a) Original signal<br />

x = cos(0.125*pi*n); subplot(2,2,1);<br />

Ha = stem(m,x(m+k1+1),’g’,’filled’); axis([-1,33,-1.1,1.1]);<br />

set(Ha,’markersize’,2); ylabel(’Amplitude’);<br />

title(’Original Sequence x(n)’,’fontsize’,TF);<br />

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

% (b) Sample rate Conversion by 3/2: I= 3, D = 2<br />

I = 3; D = 2; y = resample(x,I,D); subplot(2,2,2);<br />

Hb = stem(m,y(m+k1*I/D+1),’c’,’filled’); axis([-1,33,-1.1,1.1]);<br />

set(Hb,’markersize’,2); ylabel(’Amplitude’);<br />

title(’Sample Rate I/D: I = 3, D = 2’,’fontsize’,TF);<br />

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

% (c) Sample rate Conversion by 3/4: I= 3, D = 4<br />

I = 3; D = 4; y = resample(x,I,D); subplot(2,2,3);<br />

Hc = stem(m,y(m+k1*I/D+1),’r’,’filled’); axis([-1,33,-1.1,1.1]);<br />

set(Hc,’markersize’,2); ylabel(’Amplitude’);<br />

title(’Sample Rate I/D: I = 3, D = 4’,’fontsize’,TF);<br />

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

xlabel(’n’, ’fontsize’,LF);<br />

% (d) Sample rate Conversion by 5/8: I= 5, D = 8<br />

I = 5; D = 8; y = resample(x,I,D); subplot(2,2,4);<br />

Hd = stem(m,y(m+k1*I/D+1),’m’,’filled’); axis([-1,33,-1.1,1.1]);<br />

set(Hd,’markersize’,2); ylabel(’Amplitude’);<br />

title(’Sample Rate I/D: I = 5, D = 8’,’fontsize’,TF);<br />

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

xlabel(’n’, ’fontsize’,LF);<br />

The resulting plots are shown in Figure 9.17. The original x(n) signal has 16<br />

samples in one period of the cosine waveform. Since the first sampling rate<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!