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.

The Discrete-time Fourier Transform (DTFT) 63<br />

When {x (n l )} and {X(e jω k<br />

)} are arranged as column vectors x and X,<br />

respectively, we have<br />

X = Wx (3.3)<br />

where W is an (M +1)× N matrix given by<br />

{<br />

W =<br />

△ e −j(π/M)kn l<br />

; n 1 ≤ n ≤ n N ,<br />

}<br />

k =0, 1,...,M<br />

In addition, if we arrange {k} and {n l } as row vectors k and n respectively,<br />

then<br />

[ (<br />

W = exp −j π )]<br />

M kT n<br />

In MATLAB we represent sequences and indices as row vectors; therefore<br />

taking the transpose of (3.3), we obtain<br />

[ (<br />

X T = x T exp −j π )]<br />

M nT k<br />

(3.4)<br />

Note that n T k is an N × (M +1)matrix. Now (3.4) can be implemented<br />

in MATLAB as follows.<br />

>> k = [0:M]; n = [n1:n2];<br />

>> X = x * (exp(-j*pi/M)) .^ (n’*k);<br />

□ EXAMPLE 3.4 Numerically compute the discrete-time Fourier transform of the sequence x(n)<br />

given in Example 3.2 at 501 equispaced frequencies between [0,π].<br />

Solution<br />

MATLAB script:<br />

>> n = -1:3; x = 1:5; k = 0:500; w = (pi/500)*k;<br />

>> X = x * (exp(-j*pi/500)) .^ (n’*k);<br />

>> magX = abs(X); angX = angle(X);<br />

>> realX = real(X); imagX = imag(X);<br />

>> subplot(2,2,1); plot(k/500,magX);grid<br />

>> xlabel(’frequency in pi units’); title(’Magnitude Part’)<br />

>> subplot(2,2,3); plot(k/500,angX/pi);grid<br />

>> xlabel(’frequency in pi units’); title(’Angle Part’)<br />

>> subplot(2,2,2); plot(k/500,realX);grid<br />

>> xlabel(’frequency in pi units’); title(’Real Part’)<br />

>> subplot(2,2,4); plot(k/500,imagX);grid<br />

>> xlabel(’frequency in pi units’); title(’Imaginary Part’)<br />

The frequency-domain plots are shown in Figure 3.2. Note that the angle plot<br />

is depicted as a discontinuous function between −π and π. This is because the<br />

angle function in MATLAB computes the principal angle.<br />

□<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!