Tom, Dick and Mary Discover The FFT
Tom, Dick and Mary Discover The FFT
Tom, Dick and Mary Discover The FFT
~~
J. R. DELLER, JR.
Tom, Dick, and Mary were juniors taking a course in signal m=-m
and linear system analysis. They were just completing the ’ By using this definition of the Fourier transform, rather than the similar one
part of the course covering Fourier analysis of continuous m
signals, and were working together on an assignment with based on radian frequency, XI(O) = fe-’“ dr ,we avoid some scale factors
a seemingly countless number of problems involving the -
in the following discussion. The developments remain essentially unchanged
plotting of magnitude and phase spectra based on the
if the radian-frequency definition is used.
Fourier transform.
c
6 (f- mfq’) is the FT of the time
m = -m
m
signal T y c
6 (t- mT,) [9, p. 7231,
m = --m
and the property that multiplying two
l T s corresponds to convolution of
their time functions, they wrote,
-f* 0 f,
could be represented by a “FS” whose coefficients were The “FS coefficients are scaled samples of the (reversed time)
related to samples of time. It was simply a matter of reversing waveform x’i(t) = ~ i ( - - t ) so
the roles of time and frequency in the analysis. Dick guessed
correctly that the time samples would be xl(nTs), with Ts = m
\
the sample period T, to use in each
case. They arbitrarily chose T, = 16=
1 s for all signals. In some cases, this
was satisfactory; in others, quite un-
satisfactory. The magnitude spectrum
1
: for result for signal x/(t) is shown in
Fig. 3. (Note that the phase is either
zero or pi radians at every sample,
:
0 0 0.3125 0.625 0.9375 1.25 1.5825 1.875 2.1875 2.5
0.Wl
loo 1 x2(0 =
e4.03‘ sin(%) [u(t- 1) - u(t - 93.1)]
(18)
with u(t), the unit step function, de-
fined to be unity for t 2 0 and zero
otherwise. Based on our previous dis-
0.01 4 cussion, the group now understood
0 0.5 1 1.5 2 25
that a sample rate offs = 1 was inap-
propriate since the energy in this
damped sinusoid is concentrated
. ( a )Alleged magnitude spectrum for signal x2(t) on the range 0 2 f I 1t2 obtained by using a r o u n d the frequency
Eq. 16 with T,$= I at frequency samples f = kl128, k = 0, I,..., 64. (h)Extending the compu- fo = 5/2n = 0.796Hz.“A s a m p l i n g ‘
tations of part (a)to include the range -1 2 f < 1 =fs. (c) The true spectrum for signal x2(t). rate of f s = 2 (0.796) = 1.6 Hz is
needed to prevent ‘overlap’ in the pe-
riodic FT,”Tom noted correctly.
We digressed momentarily to discuss the phenomenon of
“What happened in this case is very revealing,” I told
aliasing. The students pointed out that they didn’t know what
them. “Look at your spectral magnitude plot (Fig. 5a). It
sample rate to use for the various signals in their homework.
to indicate energy atf=o.2 Hz, but to show
Even if they had been aware of the sampling theorem, they
had not known the bandwidths of the signals, since the task energy at the frequency of the sinusoid (which is not even in
of the problems was to plot the spectra. By using an arbitrary the range of Your Plot). What happened?’’
sample rate of& = 1 Hz, they had sometimes gotten a poor I suggested that they extend their plot to include one or
result (in terms of the approximation to the continuous-time more periods of the “overlapped” FT. Using the program
B :::0.4
0.3
0.2
0.1
0
0 5 10 15 20 25 30
Sampt., n (Actualtlma In sac,t 8 n X 0.001)
6. The N = 15-length discrete-timesignalx3(nTS),n = 0 ,I ,...,N - 1 , with Ts = I tns, used as an example in the development of the DFT.
they had written the night before, they did so (Fig. 5b), “So the DTFT is very important because it allows us to
knowing that the result would be periodic with periodf, = 1. compute a periodic replica of the continuous FT using just
While they were doing that, I plotted the true spectrum of time samples,” Dick noted.
x z ( t ) (Fig. 5c). “As long as we sample fast enough in time,” I added.
“I see what happened,” said Tom. “The bogus peak we got “Now what is the effect of the scale factor omission in the
in the range 0 Ifs 112 is the result of one of the copies of the definition of the DTFT?” I asked.
true spectrum that got shifted into that range.” They identified “No big deal,” said Tom, “it just means that the DTFT is
the “correct” peak in the periodic spectrum and convinced a scaled periodic replica of the original FT.” Looking back at
themselves that this problem would not have occurred if a his notes from the night before (Eq. lo), he wrote
proper sampling rate had been used.
“Now let me tell you a further significance of your result,”
I continued. “The ‘FS’ Yoyou’ve discovered is very close to
what is known as the discrete-time Fourier transform (DTFT)
for the discrete time signal consisting of the samples
xl(n7‘), n = ...- 1, 0, 1, 2, . ... Usually, books will tell you that
“So is the DTFT something new?” I asked them. “Or is it
the DTFT is the something like the following.” I wrote on the a natural extension of classical theory?” The question was
board rhetorical, and they were very proud of their accomplishment.
“When you see the DTFT in your work with discrete-time
signals, you will forever remember its origins since you
worked so hard to discover them.”
“Now I have a challenge for you,” I said after they had
congratulated themselves. Tom, Dick, and Mary looked
“That’s just our ‘FS’ except for a scale factor 16,” Mary astonished since they had been awake most of the night facing
said. “Yes,” I agreed, “which happened to be unity in your what they considered to be a more than sufficient challenge.
numerical work anyway. So can you tell me the significance “In the first part of your work, you show how to use a set of
of the DTFT? Think about what we’ve just worked through.” frequency samples to represent a continuous-time waveform.
“Well, we wanted to be able to plot spectra using the In the second part, you show how to use time samples to
computer, so we had to have discrete samples in both do- represent a continuous-frequency function. (Then you use
mains,” Tom said. “Yes,” I interjected, “and more generally, that result to compute frequency samples. To use a computer
computers are being used to replace all kinds of analog for spectral analysis, it would be useful to have a transform
systems and filters so that the computations, and in this case, which goes back and forth between sets of samples. You are
spectral analysis, must be done with discrete samples. Usu- close. See if you can find such a transform.”
ally, however, the samples relate to continuous phenomena “Let me give you a hint,” I added. “You notice that your
since most signals are continua. So we’d like to be able to DTFT computationuses a doubly-infinite number of time
perform ‘meaningful’ spectral analysis using the computer.” samples.”
“You mean we want to be able to relate the results to the “Yeah,” Tom agreed, “we had to chop off the signal after
continuous world, since that’s where they really come from,” a large number of samples if the original signal was not
Mary remarked. ‘time-limited’. I mean if T I = -. So I guess we only got an
“Precisely.” approximate spectrum.”
1: 03
proper value offs.”
“I appreciate what you did last
night! Now see if you can take it to
the next logical step.”
02 I’d like to tell you that Tom, Dick,
0.1 and Mary excitedly left my office,
0 eager to tackle this new challenge.
0 However, this is a true story. Some-
thing unfit for print was muttered in
the hallway as they walked away.
1
0.9
0.8 it Onward to the DFT
1:
0.7
The three students puzzled over Eqns.
7 and 9 for a while thinking maybe
they could just use a similar equation
0.3
to Eq. 7 at times t = nTs to get the time
02
0.1
samples they wanted. “But we don’t
0
really have X 3 v ) to sample,” Tom
0 5 10 15 20 25 30 36 4 0 4 5 6 0 5 5 pointed out. “What we have is a peri-
odic version of X 3 v ) that we again
call Yo. In this case, since we have
only N time samples, Eq. 16 can be
1.4 1 simplified.” He wrote
12
1
N- 1 (22)
j: “~
fl=O
0.4
“Of course, we can compute any
02 samples off that we want, but which
0 ones?” Dick wondered. They pon-
0 5 10 15 dered this for a long time. Mary reit-
erated the point that the signal xj(t)
could not be frequency bandlimited
because it is time-limited. Neverthe-
7. The signal y(nT,) of Eq. 24 when (a)fu = llNTs =fa;
(bjf? < llNTs; ( c j f , 2 I I N T S . Each
less, she suggested that they go back
waveform repeats indefinitely in both positive and negative time.
and look at what happened in their
m (23)
y ( t )= C x3(t - kNTs)
k=- (R 0 fJ2
“fW)
“And, if we used Eq. 7 at times nTs, 8. Hypothetical FT Y3(3 defined to be identical to Y ( f ,of Fig. 2c on its primary p e r i o d .
then we would get the numbers:”
m
(24) the original signal, x~(t)had been bandlimited and sampled
y(nTs) = x3(nTs - kNT,) fast enough.
k=-m “Right on both counts,” said Tom, “but Mary is consider-
ing the general case in which Y v ) and YjV, might involve
They sketched the sequence y(nT,) on the blackboard (Fig. some aliasing. I also see what she’s trying to do by making
7a) and discovered that the first N points were exactly the y.&) a continuous-time signal. She’s taking us back to the very
sequence xj(nT,). In fact, they varied the value off, = 1/T, and first problem we studied last night- continuous-time, dis-
discovered that using a smaller value off, = 1/NT, would crete-frequency .”
cause “extra space” (zeros) between the copies of x/(t) in y ( t ) “I see where we’re going,” responded Dick, “but if we
(Fig. 7b), and “overlap” (time aliasing) of the copies would follow the approach we did last night, we’ll end up writing a
occur iff, were chosen too large,& > 1/T, (Fig. 7c). FS for a periodic version of yj(r), not y(t). Then we’ll evaluate
“But we don’t have the samples of X j ( f ) to work with,” at discrete times, and end up with samples of a periodic
noted Dick. “We have only a periodic, maybe aliased, version version of yj(t), not samples of y(t), and certainly not the
of Xjv).” samples xj(nT,).”
“I have a hunch that samples of Y v ) taken at the right “Go ahead and do it anyway,” Tom persisted. ‘‘I think it
will work.” So they began to meticulously follow the steps
spacing f , S J i N will still give us back the periodic sequence
that had become familiar by now. First they created the
(Eq. 24),” Tom said. ”Something like what happened when
periodic extension of the somewhat mysterious signal yj(r):
we sampled the aliased periodic FT last night (Eqns. 7-9),” he
added with some uncertainty in his voice. m
They knew that this case had to have something to do with
the first analysis they had done the night before concerning w(t)= y3(t - iT,])
frequency sampling. They began to pore over those results. I = -m
“Look at the pattern we followed there,” said Mary. “We had
a bandlimited signalxl(t) and we let it become periodic so that anticipating that they would sample Y3(f) at spacing fw =
we could discretize the frequency domain. I think we want to UTw. They all agreed that T w would have to be some multiple
do the same thing here. Forget the fact that Y(f) is periodic. of Ts because the period would ultimately have to be some
That’s what’s throwing us off. Just look at one period of it,” integer number of samples, say,
and she wrote on the blackboard the following definition:
1
T w = M T ~ ,or f w = -
MTs
k=-m They now had frequency samples on the right side with
which they could compute time sam-
ples. In particular, they wanted sam-
c
*
‘i 7
ples at times nT,, n = 0, 1, . .. , N-1.
So they evaluated w(t) at the discrete
times,
ii: w(nTs)= -
TW
m
k=-w
“Great,” muttered Dick, sarcasti-
(33)
1 Z Y ( k f w )e j2*kfwnTs
P-~I= x3(nT.,)
.j A,
y3(nT.,) =fs (35)
then,
- .
0
Id
9. Samples of the (a)magnitude, and ( b )phase, spectra of the discrete-time signal x3(nTs) of
Recalling their agreement (Eq. 27),
Fig. 6 obtained using Eq. 39. (c)Magnitude spectrum of the continuous-time signal x3(t) of
Eq. 21.
she finally wrote
n = 0, 1, ..., N-1
2 1 t t
1 -
0
0 1
1
2
T
3
?
4
?
5
T
6
?
7
?
8
?
9
? ? ? T
1 0 1 1 1 2 1 3 1 4 1 5
1
Frequency sample, k (Actual frequency In H q f = lo00 W16)
1
10. Magnitude spectrum of the 16-point DFT of the sequence x3(nTs)
Y D T-
r):
What this means is that, in either case, instead of computing
~ for negative values of k, we can compute over
nonnegative k values only. In either case, N odd or even, the
values of k used are k = 0, 1,2, ..., N-1.” The students played
$,. Your samples on this range k = 0, 1, ..., 8 in either Fig. 9a
or 10 compare favorably with the continuous spectrum. That
is, they appear to be proper samples of the DTFT spectrum.”
“But we don’t see much of the detail in the spectrum,” Tom
pointed out. “Yes, that’s exactly what I wanted you to notice,”
with a few values of N to convince themselves that this was I said. “Is there a remedy for this problem? Remember how
true. “Therefore, we can use Eq. 40 for these nonnegative k’s you sampled the FT at arbitrary frequencies in doing your
and modify Eq. 41 to read:” homework plots (Eq. 17)?
“I think the same basic idea applies here,” said Mary. “If
we rewrite the D F I relation (Eq. 40) as
(45)
“The pair of relations (Eq. 40, used fork = 0, 1 , 2,..., N-1;
and Eq. U ) ,are the essence of the discrete Fourier transform k n=O
(DFT),” I elaborated. There is a group of efficient algorithms
for computing the DFT relations that take advantage of the it is obvious that the kth result is the sample of the DTFT at
symmetry properties of the quantities involved. These algo- frequency f = k fslN. I guess we could compute these samples
rithms are collectively known as the fast Fourier transform at whatever frequencies we want.”
(FFT) (e.g, see [lo-131). We took a moment to compute the “That’s right,” I responded, “and a common thing to do is
DFT of Eq. 40 and to plot the resulting magnitude spectrum to compute these samples at the frequencies kf,/M for k = 0,
(Fig. 10) and to verify that the inverse, Eq. 44, indeed pro- 1,..., M-1 with M > N . This gives us M equally (and more
T . ~ ) in Fig. 6. The picture
duced the 16 samples of X ~ ( ~ shown closely) spaced samples of the D T R . M is frequently taken
made clear that the DFT are samples of the first period of the to be a power of two, since efficient and widely-available DFT
DTFT on nonnegative frequencies, rather than the “primary (FFT) algorithms exist for this case. In this case, the DFT
period” that straddles f = 0. relation becomes
“Let’s review the significance of your DFT relations,” I
encouraged them. “We will always have to work with a
finite-duration signal on the computer, like x3(t), Dick began.
“We then take N samples. The forward transform 40) (m.
allows us to compute samples of the DTFT.”
“What is the significance of those samples?” I asked.
“Well, the DTFT will have to be an aliased version of the
continuous-time FT, Xi(f),” Mary said. “ x l ( t ) cannot be ban-
dlimited because it is time-limited.’’
“Right,” I agreed. “Do you suppose this means that we can The last equality follows because x3(nTs) is assumed to be
t: 3 T
2
I~ 01 0
TTTlTTTTTTTT?TTT??T???T???T~~TTT~TTT?TTTTTlTT~lT?l, 1