next FFT of a Zero-Padded Sinusoid
previous FFT of a Simple Sinusoid
up Spectrum Analysis of a Sinusoid   Contents   Global Contents
global_index Global Index   Index   Search

FFT of a Not-So-Simple Sinusoid

Now let's increase the frequency in the above example by one-half of a bin:

% Example 2 = Example 1 with frequency between bins

f = 0.25 + 0.5/N;   % Move frequency up 1/2 bin

x = cos(2*pi*n*f*T); % Signal to analyze
X = fft(x);          % Spectrum
...                  % See Example 1 for plots and such

Figure: Sinusoid at Frequency $ f=0.25+0.5/N$. a) Time waveform. b) Magnitude spectrum. c) DB magnitude spectrum.
\resizebox{\textwidth}{!}{\includegraphics{eps/example2.eps}}

The resulting magnitude spectrum is shown in Fig. 8.2b and c. At this frequency, we get extensive ``spectral leakage'' into all the bins. To get an idea of where this is coming from, let's look at the periodic extension of the time waveform:

% Plot the periodic extension of the time-domain signal
plot([x,x],'--ok');
title('Time Waveform Repeated Once');
xlabel('Time (samples)'); ylabel('Amplitude');
The result is shown in Fig. 8.3. Note the ``glitch'' in the middle where the signal begins its forced repetition.

Figure: Time waveform repeated to show discontinuity introduced by periodic extension (see midpoint).
\resizebox{\textwidth}{2in}{\includegraphics{eps/waveform2.eps}}


next FFT of a Zero-Padded Sinusoid
previous FFT of a Simple Sinusoid
up Spectrum Analysis of a Sinusoid   Contents   Global Contents
global_index Global Index   Index   Search

``Mathematics of the Discrete Fourier Transform (DFT)'', by Julius O. Smith III, W3K Publishing, 2003, ISBN 0-9745607-0-7.

(Browser settings for best viewing results)
(How to cite this work)
(Order a printed hardcopy)

Copyright © 2003-10-09 by Julius O. Smith III
Center for Computer Research in Music and Acoustics (CCRMA),   Stanford University
CCRMA  (automatic links disclaimer)