Digital Signal Processing Reference
In-Depth Information
EXAMPLE 12.15
Comparison of windowing functions on the accuracy of the FFT
The Fourier transform of the signal
x(t) = cos(10pt)
is to be approximated by calculating the
DFT.
1.
It has been determined that a discrete-frequency resolution of is required for
our purpose. This is equivalent to Because we plan to use a radix-2 FFT
for the DFT calculation, we choose a 64-point FFT. This will result in a discrete-frequency
resolution of
¢Æ F
0.1
¢Æ = 2p/62.83.
¢Æ = p/32.
To calculate a 64-point FFT, we must use 64 samples of the
signal
(N = 64).
2.
The signal is absolutely bandlimited. Actually, it contains only one frequency compo-
nent at
v = 10p rad/s.
The Nyquist frequency for this signal is
20p rad/s.
We arbitrarily
choose to sample the signal at
v s = 100p rad/s (T = 0.02 s),
which is five times the min-
imum sampling frequency.
3.
Figure 12.21(a) shows the sampled data sequence. We are now assuming a rectangular
window of
NT = (64) (0.02) = 1.28 s
duration.
4.
The DFT is calculated by a 64-point FFT algorithm. Figure 12.21(b) shows the discrete-
frequency sequence. We see in Figure 12.21(b) the evidence of spectrum spreading. We
know that the frequency spectrum of the original analog signal has discrete-frequency
components at
v = 10p
only. The DFT shows nonzero frequency components through-
out the spectrum.
A Hanning window will be used to reduce the errors in the DFT caused by spectrum
spreading. Figure 12.21(c) shows the discrete-time sequence produced with the use of
the Hanning window. Figure 12.21(d) shows the new discrete-frequency spectrum. It is seen
that the spectrum-leakage distortion is reduced by the use of a Hanning window instead of a
rectangular window.
The results shown in this example can be reproduced by the following MATLAB
program:
x[n]
% This MATLAB program reproduces the results of
% Example 12.15.
win = input...
('Is window to be:(1) rectangular or (2) Hanning?')
Ts=1/50;
t = Ts*(0:63);
for n = 1:64
xn(n) = cos(10*pi*t(n));
end
if win == 2
xw = hanning(64)'.*xn;
else
xw = xn;
end
figure(1), stem(t,xw,'filled'), title('Windowed Time Sequence')
grid, xlabel('seconds'), ylabel('magnitude')
X = fft(xw,64);
w = 2/Ts*(-32:31)/64;
figure(2),stem(w, Ts*abs(fftshift(X)),'filled'),title('Magnitude of T*F[k]')
grid,xlabel('omega/pi'),ylabel('magnitude')
Search WWH ::




Custom Search