DTFT, DFT, FFT PDF
DTFT, DFT, FFT PDF
DTFT, DFT, FFT PDF
(DTFT)
Don Johnson
This work is produced by The Connexions Project and licensed under the
Creative Commons Attribution License
Abstract
Discussion of Discrete-time Fourier Transforms.
X
s (n) e(i2f n)
S ei2f =
n=
Frequency here has no units. As should be expected, this denition is linear, with the transform of a
sum of signals
equaling the sum of their transforms. Real-valued signals have conjugate-symmetric spectra:
).
S e
= S (e
Exercise 1
(Solution on p. 7.)
A special property of the discrete-time Fourier transform is that it is periodic with period one:
S e
=S e
. Derive this property from the denition of the DTFT.
Because of this periodicity, we need only plot the spectrum over one period to understand completely the
spectrum's structure; typically, we plot the spectrum over the frequency range , . Whenthe signal
is real-valued, we can further simplify our plotting chores by showing the spectrum only over 0, ; the
spectrum at negative frequencies can be derived from positive-frequency spectral values.
When we obtain the discrete-time signal via sampling an analog signal, the Nyquist frequency corresponds to the discrete-time frequency . To show this, note that a sinusoid having a frequency equal to the
Nyquist frequency has a sampled waveform that equals
(i2f )
j2f
i2(f +1)
i2f
1
2
1
2
1
2
1
2Ts
1
2
1
n
nT s = cos (n) = (1)
cos 2
2T s
The exponential in the DTFT at frequency equals e ( ) = e = (1) , meaning that discrete-time
frequency equals analog frequency multiplied by the sampling interval
f =f T
(2)
1
2
Version
(in)
A s
http://creativecommons.org/licenses/by/1.0
1 "The
i2n
2
http://cnx.org/content/m10247/2.31/
and f represent discrete-time and analog frequency variables, respectively. The aliasing gure provides another way of deriving this result. As the duration of each pulse in the periodic sampling signal
p (t) narrows, the amplitudes of the signal's spectral repetitions, which are governed by the Fourier series
coecients of p (t), become increasingly equal. Examination of the periodic pulse signal reveals that as
. Thus, to maintain
decreases, the value of c , the largest Fourier coecient, decreases to zero: |c | =
a mathematically viable Sampling Theorem, the amplitude A must increase as , becoming innitely large
as the pulse duration decreases. Practical systems use a small value of , say 0.1 T and use ampliers to
rescale the signal. Thus, the sampled signal's spectrum becomes periodic with period . Thus, the Nyquist
frequency corresponds to the frequency .
Example 1
Let's compute the discrete-time Fourier transform of the exponentially decaying sequence s (n) =
a u (n), where u (n) is the unit-step sequence. Simply plugging the signal's expression into the
Fourier transform formula,
fD
Ts
Ts
0
1
A
Ts
s
1
2Ts
1
Ts
1
2
S ei2f
=
=
n=
P
n=0
an u (n) e(i2f n)
n
ae(i2f )
(3)
(n ) = , || < 1 :
n=0
1
1
(4)
(5)
1
1 ae(i2f )
Using Euler's relation, we can express the magnitude and phase of this spectrum.
|S ei2f | = q
(6)
1
2
No matter what value of a we choose, the above formulae clearly demonstrate the periodic nature
of the spectra of discrete-time signals. Figure 1 (Spectrum of exponential signal) shows indeed
that
the spectrum is a periodic function. We need only consider the spectrum between and to
unambiguously dene it. When a > 0, we have a lowpass spectrumthe spectrum diminishes as
frequency increases from 0 to with increasing a leading to a greater low frequency content; for
a < 0, we have a highpass spectrum (Figure 2 (Spectra of exponential signals)).
1
2
1
2
http://cnx.org/content/m10247/2.31/
1
2
(7)
|S(ej2f)|
f
-2
-1
S(ej2f)
45
-2
-1
-45
Figure 1:
a = 0.5)
clearly demonstrating the periodicity of all discrete-time spectra. The angle has units of degrees.
http://cnx.org/content/m10247/2.31/
Angle (degrees)
Figure 2:
20
a = 0.9
10
0
a = 0.5
0.5
a = 0.5
-10
90
45
a = 0.5
f
0.5
a = 0.5
-90 a = 0.9
-45
a = 0.5
and
a = 0.5?
Example 2
Analogous to the analog pulse signal, let's nd the spectrum of the length-N pulse sequence.
1 if 0 n N 1
s (n) =
0 otherwise
The Fourier transform of this sequence has the form of a truncated geometric series.
S e
i2f
N
1
X
e(i2f n)
N +n
0 1
X
(n ) = n0
n=n0
1 N
1
(8)
(9)
(10)
=
=
http://cnx.org/content/m10247/2.31/
1e(i2f N )
1e(i2f )
N)
e(if (N 1)) sin(f
sin(f )
(11)
i2f
(if (N 1))
Figure 3:
The inverse discrete-time Fourier transform is easily derived from the following relationship:
1 if m = n
R
e
e
df =
( )
0 if m 6= n
1
2
(i2f m) i2f n
1
2
(12)
(m n)
1
2
1
2
S ei2f ei2f n df
=
=
=
1
2
(i2f m) i2f n
df
s
(m)
e
e
( )
R 21
P
((i2f ))(mn)
s
(m)
e
df
m
( 12 )
1
2
(13)
s (n)
http://cnx.org/content/m10247/2.31/
(14)
The properties of the discrete-time Fourier transform mirror those of the analog Fourier transform. The
DTFT properties table shows similarities and dierences. One important common property is Parseval's
Theorem.
Z
X
|S e
| df
(15)
(|s (n) |) =
( )
To show this important property, we simply substitute the Fourier transform expression into the frequencydomain expression for power.
5
1
2
n=
1
2
1
2
2
|S ei2f | df
1
2
i2f
1
2
P
i2f m
(i2f n)
s
(n)e
df
s
(n)
e
m
( )
R 21
P
i2f (mn)
=
df
(n,m) s (n) s (n) ( 1 ) e
2
1
2
(16)
Using the orthogonality relation (12), the integral equals (m n), where (n) is the unit sample . Thus,
the double sum collapses into aPsingle sum because nonzero values occur only when n = m, giving Parseval's
Theorem as a result. We term s (n) the energy in the discrete-time signal s (n) in spite of the fact that
discrete-time signals don't consume (or produce for that matter) energy. This terminology is a carry-over
from the analog world.
Exercise 3
(Solution on p. 7.)
Suppose we obtained our discrete-time signal from values of the product s (t) p (t), where the
duration of the component pulses in p (t) is . How is the discrete-time signal energy related to
the total energy contained in s (t)? Assume the signal is bandlimited and that the sampling rate
was chosen appropriate to the Sampling Theorem's conditions.
6
Ts
Ts
5 "Discrete-Time
6 "Discrete-Time
http://cnx.org/content/m10247/2.31/
S ei2(f +1)
=
=
=
=
n=
P
n=
P
n=
i2f
(17)
S e
N +n
0 1
X
n=n0
(n )
N +n
0 1
X
n=n0
(n ) = N +n0 n0
http://cnx.org/content/m10247/2.31/
Don Johnson
This work is produced by The Connexions Project and licensed under the
Creative Commons Attribution License
Abstract
The Fourier transform can be computed in discrete-time despite the complications caused by a nite
signal and continuous frequency.
The discrete-time Fourier transform (and the continuous-time transform as well) can be evaluated when
we have an analytic expression for the signal. Suppose we just have a signal, such as the speech signal used
in the previous chapter. You might be curious; how did we compute a spectrogram such as the one shown
in the speech signal example ? The big dierence between the continuous-time and discrete-time worlds is
that we can exactly calculate spectra in discrete-time. For analog-signal spectra, use must build special
devices, which turn out in most cases to consist of A/D converters and discrete-time computations. Certainly
discrete-time spectral analysis is more exible than in continuous-time.
The formula for the DTFT is a sum, which conceptually can be easily computed save for two issues.
1
Signal duration. The sum extends over the signal's duration, which must be nite to compute the
signal's spectrum. It is exceedingly dicult to store an innite-length signal in any case, so we'll
assume that the signal extends over [0, N 1].
Continuous frequency. Subtler than the signal duration
issue is the fact that the frequency variable
is continuous: It may only need to span one period, like 12 , 12 or [0, 1], but the DTFT formula as it
stands requires evaluating the spectra at all frequencies within a period. Let's compute the spectrum at
a few frequencies; the most obvious ones are the equally spaced ones k, k {k, . . . , K 1} : f = Kk .
Fourier transform
(DFT) to be
k, k {k, . . . , K 1} :
S (k) =
N
1
X
!
S (n) e
k
(i)2n K
n=0
Version
http://creativecommons.org/licenses/by/1.0
http://cnx.org/content/m0502/2.5/
(1)
Abstract
This module describes the fast Fourier Transform (FFT).
1 Introduction
The Fast Fourier Transform (FFT) is an ecient O(NlogN) algorithm for calculating DFTs The FFT 1 exploits
symmetries in the W matrix to take a "divide and conquer" approach. We will rst discuss deriving the
actual FFT algorithm, some of its implications for the DFT, and a speed comparison to drive home the
importance of this powerful algorithm.
2(N 2)k
+ + s (N 2) e(i) N
s (0) + s (2) e(i) N
2(2+1)k
2(N 2+1)k
N
+ s (3) e(i) N
+ + s (N 1) e(i)
2 ( N
2 1)k
(i)
(i) 2k
N
N
2
2
s(0)
+
s (2) e
+
+ s (N 2) e
N
2 ( 2 1)k
(i)
(i) 2k
N
N
s (1) + s (3) e
e (i2k)
2 + + s (N 1) e
2
N
S (k)
=
(i) 2k
N
s (1) e
+
=
(1)
Each term in square brackets has the form of a N2 -length DFT. The rst one is a DFT of the evennumbered elements, and the second of the odd-numbered elements. The rst DFT is combined with the
(i2k)
second multiplied by the complex exponential e N
. The half-length transforms are each evaluated at
frequency indices k {0, . . . , N 1} . Normally, the number of frequency indices in a DFT calculation range
between zero and the transform length minus one. The computational advantage of the FFT comes from
recognizing the periodic nature of the discrete Fourier transform. The FFT simply reuses the computations
(i2k)
made in the half-length transforms and combines them through additions and the multiplication by e N
Version
http://creativecommons.org/licenses/by/1.0
http://cnx.org/content/m10783/2.7/
N
2
), multiply one of them by the complex exponential (complexity O (N ) ), and add the results (complexity
O (N ) ). At this point, the total complexity is still dominated by the half-length DFT calculations, but the
proportionality coecient has been reduced.
Now for the fun. Because N = 2l , each of the half-length transforms can be reduced to two quarter-length
transforms, each of these to two eighth-length ones, etc. This decomposition continues until we are left with
length-2 transforms. This transform is quite simple, involving only additions. Thus, the rst stage of the
FFT has N2 length-2 transforms (see the bottom part of Figure 1 (Length-8 DFT decomposition)). Pairs of
these transforms are combined by adding one to the other multiplied by a complex exponential. Each pair
requires 4 additions and 4 multiplications, giving a total number of computations equaling 8 N4 = N2 . This
number of computations does not change from stage to stage. Because the number of stages, the number of
times the length can be divided by two, equals log2 N , the complexity of the FFT is O (N logN ) .
(a)
(b)
Figure 1: The initial decomposition of a length-8 DFT into the terms using even- and odd-indexed
inputs marks the rst phase of developing the FFT algorithm. When these half-length transforms are
successively decomposed, we are left with the diagram shown in the bottom panel that depicts the
length-8 FFT computation.
Doing an example will make computational savings more obvious. Let's look at the details of a length-8
DFT. As shown on Figure 1 (Length-8 DFT decomposition), we rst decompose the DFT into two lengthhttp://cnx.org/content/m10783/2.7/
4 DFTs, with the outputs added and subtracted together in pairs. Considering Figure 1 (Length-8 DFT
decomposition) as the frequency index goes from 0 through 7, we recycle values from the length-4 DFTs
into the nal calculation because of the periodicity of the DFT output. Examining how pairs of outputs are
collected together, we create the basic computational element known as a buttery (Figure 2 (Buttery)).
Buttery
Figure 2: The basic computational element of the fast Fourier transform is the buttery. It takes two
complex numbers, represented by a and b, and forms the quantities shown. Each buttery requires one
complex multiplication and two complex additions.
By considering together the computations involving common output frequencies from the two half-length
DFTs, we see that the two complex multiplies are related to each other, and we can reduce our computational
work even further. By further decomposing the length-4 DFTs into two length-2 DFTs and combining their
outputs, we arrive at the diagram summarizing the length-8 fast Fourier transform (Figure 1 (Length-8 DFT
decomposition)). Although most of the complex multiplies are quite simple (multiplying by e(i) means
negating real and imaginary parts), let's count those for purposes of evaluating the complexity as full complex
multiplies. We have N2 = 4 complex multiplies and 2N = 16 additions for each stage and log2 N = 3 stages,
making the number of basic computations 3N
2 log2 N as predicted.
Exercise 1
(Solution on p. 6.)
Note that the ordering of the input sequence in the two parts of Figure 1 (Length-8 DFT decomposition) aren't quite the same. Why not? How is the ordering determined?
http://cnx.org/content/m10783/2.7/
each real-times-complex multiplication requires two real multiplications, meaning we have 2N multiplications
to perform. To add the results together, we must keep the real and imaginary parts separate. Adding N
numbers requires N 1 additions. Consequently, each frequency requires 2N + 2 (N 1) = 4N 2 basic
computational steps. As we have N frequencies, the total number of computations is N (4N 2).
In complexity calculations, we only worry about what happens as the data lengths increase, and take the
dominant termhere the 4N 2 termas reecting how much work is involved in making the computation.
As multiplicative constants don't matter since we are making a "proportional to" evaluation, we nd the
DFT is an O N 2 computational procedure. This notation is read "order N -squared". Thus, if we double
the length of the data, we would expect that the computation time to approximately quadruple.
Exercise 2
(Solution on p. 6.)
In making the complexity evaluation for the DFT, we assumed the data to be real. Three questions emerge. First of all, the spectra
of such signals have conjugate symmetry, meaning that
negative frequency components (k = N2 + 1, ..., N + 1 in the DFT3 ) can be computed from the
corresponding positive frequency components. Does this symmetry change the DFT's complexity?
Secondly, suppose the data are complex-valued; what is the DFT's complexity now?
Finally, a less important but interesting question is suppose we want K frequency values instead
of N ; now what is the complexity?
3 Speed Comparison
How much better is O(NlogN) than O( N 2 )?
Figure 3: This gure shows how much slower the computation time of an O(NlogN) process grows.
10
100
1000
106
109
N2
100
104
106
1012
1018
N logN
200
3000
6 106
9 109
Table 1
Say you have a 1 MFLOP machine (a million "oating point" operations per second). Let N = 1million =
106 .
An O( N 2 ) algorithm takes 1012 ors 106 seconds ' 11.5 days.
An O( N logN ) algorithm takes 6 106 Flors 6 seconds.
3 "Discrete Fourier Transform", (1) : Discrete Fourier transform <http://cnx.org/content/m0502/latest/#eqn1>
http://cnx.org/content/m10783/2.7/
note:
N = 1million is
not unreasonable.
Example 1
3 megapixel digital camera spits out 3106 numbers for each picture. So for two N point sequences
f [n] and h [n]. If computing (f [n] ~ h [n]) directly: O( N 2 ) operations.
taking FFTs O(NlogN)
multiplying FFTs O(N)
inverse FFTs O(NlogN).
the total complexity is O(NlogN).
4 Conclusion
Other "fast" algorithms have been discovered, most of which make use of how many common factors the
transform length N has. In number theory, the number of prime factors a given integer has measures how
composite it is. The numbers 16 and 81 are highly composite (equaling 24 and 34 respectively), the
number 18 is less so ( 21 32 ), and 17 not at all (it's prime). In over thirty years of Fourier transform
algorithm development, the original Cooley-Tukey algorithm is far and away the most frequently used. It
is so computationally ecient that power-of-two transform lengths are frequently used regardless of what
the actual length of the data. It is even well established that the FFT, alongside the digital computer, were
almost completely responsible for the "explosion" of DSP in the 60's.
http://cnx.org/content/m10783/2.7/
The upper panel has not used the FFT algorithm to compute the length-4 DFTs while the lower one has.
The ordering is determined by the algorithm.
When the signal is real-valued, we may only need half the spectral values, but the complexity remains
unchanged. If the data are complex-valued, which demands retaining all frequency values, the complexity is
again the same. When only K frequencies are needed, the complexity is O (KN).
http://cnx.org/content/m10783/2.7/