Signals and Systems - Electrical Engineering

(avery) #1

578 C H A P T E R 10: Fourier Analysis of Discrete-Time Signals and Systems


n The functionabscomputes the magnitude and the functionanglecomputes the phase of the
frequency response. The magnitude and the phase are even and odd symmetric when plotted in
ω∈[−π,π)or in the normalized frequencyω/π∈[−1, 1).

The three signals in the following script are a rectangular pulse, a windowed sinusoid, and a chirp. In
the script, to process one of the signals you delete the corresponding comment % and keep it for the
other two. The length of the FFT is set toL=256, which is larger or equal to the length of either of
the three signals.

%%%%%%%%%%%%%%%%%%%%%%
% DTFT of aperiodic signals
%%%%%%%%%%%%%%%%%%%%%%
% signals
L = 256; % length of FFT with added zeros
% N = 21; x = [ones(1,N) zeros(1,L - N)]; % pulse
% N = 200; n = 0:N - 1; x = [cos(4∗pi∗n/N) zeros(1,L - N)]; % windowed sinusoid
n = 0:L - 1; x = cos(pi∗n. ˆ 2/(4∗L)); % chirp
X = fft(x);
w = 0:2∗pi/L:2∗pi - 2∗pi/L;w1 = (w - pi)/pi; % normalized frequency
n = 0:length(x) - 1;
subplot(311)
stem(n,x); axis([0 length(n) - 1 1.1∗min(x) 1.1∗max(x)]); grid;
xlabel(‘n’); ylabel(‘x(n)’)
subplot(312)
plot(w1,fftshift(abs(X))); axis([min(w1) max(w1) 0 1.1∗max(abs(X))]);
ylabel(‘|X|’); grid
subplot(313)
plot(w1,fftshift(angle(X))); ylabel(‘<X’); xlabel(‘ω/π’); grid
axis([min(w1) max(w1) 1.1∗min(angle(X)) 1.1∗max(angle(X))])

As expected, the magnitude spectrum for the rectangular pulse is like a sinc. The windowed sinusoid
has a spectrum that resembles that of the sinusoid but the rectangular window makes it broader.
Finally, a chirp is a sinusoid with time-varying frequency; thus its magnitude spectrum displays com-
ponents over a range of frequencies. We will comment on the phase spectra later. The results are
shown in Figure 10.1.

Sampled Signals
When computing the DTFT of a sampled signal, it is important to display the frequency in radi-
ans/second or in hertz rather than the discrete frequency in radians. The discrete frequencyω(rad)
is converted into the analog signal(rad/sec) according to the relationω=TswhereTsis the
sampling period used. Thus,

=ω/Tsrad/sec (10.13)

If the signal is sampled according to the Nyquist sampling rate condition, the discrete-frequency
rangeω∈[−π,π)(rad) corresponds to∈[−π/Ts,π/Ts)or [−s/2,s/ 2 ), wheres/ 2 ≥max
Free download pdf