dtft, dft, fft.pdf
TRANSCRIPT
-
Connexions module: m10247 1
Discrete-Time Fourier Transform
(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. Topics include comparison with analog transforms
and discussion of Parseval's theorem.
The Fourier transform of the discrete-time signal s (n) is dened to be
S(ei2pif
)=
n=
(s (n) e(i2pifn)
)(1)
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(i2pif)
)= S (ej2pif ).Exercise 1 (Solution on p. 7.)
A special property of the discrete-time Fourier transform is that it is periodic with period one:
S(ei2pi(f+1)
)= S
(ei2pif
). 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
[ ( 12) , 12]. When the signalis real-valued, we can further simplify our plotting chores by showing the spectrum only over
[0, 12]; 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
1
corre-
sponds to the discrete-time frequency
12 . To show this, note that a sinusoid having a frequency equal to the
Nyquist frequency
12Tshas a sampled waveform that equals
cos(
2pi1
2TsnTs
)= cos (pin) = (1)n
The exponential in the DTFT at frequency
12 equals e
( i2pin2 ) = e(ipin) = (1)n, meaning that discrete-timefrequency equals analog frequency multiplied by the sampling interval
fD = fATs (2)
Version 2.31: Jul 6, 2009 5:25 pm GMT-5
http://creativecommons.org/licenses/by/1.0
1
"The Sampling Theorem"
http://cnx.org/content/m10247/2.31/
-
Connexions module: m10247 2
fD and fA represent discrete-time and analog frequency variables, respectively. The aliasing gure2
pro-
vides another way of deriving this result. As the duration of each pulse in the periodic sampling signal
pTs (t) narrows, the amplitudes of the signal's spectral repetitions, which are governed by the Fourier seriescoecients
3
of pTs (t), become increasingly equal. Examination of the periodic pulse signal4
reveals that as
decreases, the value of c0, the largest Fourier coecient, decreases to zero: |c0| = ATs . Thus, to maintaina mathematically viable Sampling Theorem, the amplitude A must increase as 1 , becoming innitely largeas the pulse duration decreases. Practical systems use a small value of , say 0.1 Ts and use ampliers torescale the signal. Thus, the sampled signal's spectrum becomes periodic with period
1Ts. Thus, the Nyquist
frequency
12Tscorresponds to the frequency
12 .
Example 1
Let's compute the discrete-time Fourier transform of the exponentially decaying sequence s (n) =anu (n), where u (n) is the unit-step sequence. Simply plugging the signal's expression into theFourier transform formula,
S(ei2pif
)=
n=
(anu (n) e(i2pifn)
)=
n=0
((ae(i2pif)
)n) (3)This sum is a special case of the geometric series.
n=0
(n) = , || < 1 :(
11
)(4)
Thus, as long as |a| < 1, we have our Fourier transform.
S(ei2pif
)=
11 ae(i2pif) (5)
Using Euler's relation, we can express the magnitude and phase of this spectrum.
|S (ei2pif) | = 1(1 acos (2pif))2 + a2sin2 (2pif)(6)
(S(ei2pif
))=
(tan1
(asin (2pif)
1 acos (2pif)))(7)
No matter what value of a we choose, the above formulae clearly demonstrate the periodic natureof 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 ( 12) and 12 tounambiguously dene it. When a > 0, we have a lowpass spectrumthe spectrum diminishes asfrequency increases from 0 to
12with increasing a leading to a greater low frequency content; for
a < 0, we have a highpass spectrum (Figure 2 (Spectra of exponential signals)).
2
"The Sampling Theorem", Figure 2: aliasing
3
"Complex Fourier Series", (10)
4
"Complex Fourier Series", Figure 1
http://cnx.org/content/m10247/2.31/
-
Connexions module: m10247 3
Spectrum of exponential signal
-2 -1 0 1 2
1
2
f
|S(ej2pif)|
-2 -1 1 2
-45
45
f
S(ej2pif)
Figure 1: The spectrum of the exponential signal (a = 0.5) is shown over the frequency range [-2, 2],clearly demonstrating the periodicity of all discrete-time spectra. The angle has units of degrees.
http://cnx.org/content/m10247/2.31/
-
Connexions module: m10247 4
Spectra of exponential signals
f
a = 0.9
a = 0.5
a = 0.5
Spec
tral M
agni
tude
(dB)
-10
0
10
20
0.5
a = 0.9a = 0.5
a = 0.5
Angl
e (de
grees
)
f
-90
-45
0
45
90
0.5
Figure 2: The spectra of several exponential signals are shown. What is the apparent relationship
between the spectra for 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.
s (n) =
1 if 0 n N 10 otherwise (8)The Fourier transform of this sequence has the form of a truncated geometric series.
S(ei2pif
)=N1n=0
(e(i2pifn)
)(9)
For the so-called nite geometric series, we know that
N+n01n=n0
(n) = n01 N1 (10)
for all values of .
Exercise 2 (Solution on p. 7.)
Derive this formula for the nite geometric series sum. The "trick" is to consider the dierence
between the series' sum and the sum of the series multiplied by .
Applying this result yields (Figure 3 (Spectrum of length-ten pulse).)
S(ei2pif
)= 1e
(i2pifN)1e(i2pif)
= e(ipif(N1)) sin(pifN)sin(pif)(11)
http://cnx.org/content/m10247/2.31/
-
Connexions module: m10247 5
The ratio of sine functions has the generic form of
sin(Nx)sin(x) , which is known as the discrete-time sinc
functiondsinc (x). Thus, our transform can be concisely expressed as S(ei2pif
)= e(ipif(N1))dsinc (pif).The discrete-time pulse's spectrum contains many ripples, the number of which increase with N , the pulse'sduration.
Spectrum of length-ten pulse
Figure 3: The spectrum of a length-ten pulse is shown. Can you explain the rather complicated
appearance of the phase?
The inverse discrete-time Fourier transform is easily derived from the following relationship:
12
( 12 )e(i2pifm)ei2pifndf =
1 if m = n0 if m 6= n= (m n)(12)
Therefore, we nd that 12
( 12 )S(ei2pif
)ei2pifndf =
12
( 12 )m
(s (m) e(i2pifm)ei2pifn
)df
=m
(s (m)
12
( 12 )e((i2pif))(mn)df
)= s (n)
(13)
The Fourier transform pairs in discrete-time are
S(ei2pif
)=n=
(s (n) e(i2pifn)
)s (n) =
12
( 12 )S(ei2pif
)ei2pifndf(14)
http://cnx.org/content/m10247/2.31/
-
Connexions module: m10247 6
The properties of the discrete-time Fourier transform mirror those of the analog Fourier transform. The
DTFT properties table
5
shows similarities and dierences. One important common property is Parseval's
Theorem. n=
((|s (n) |)2
)= 1
2
( 12 )
(|S (ei2pif) |)2df (15)To show this important property, we simply substitute the Fourier transform expression into the frequency-
domain expression for power. 12
( 12 )(|S (ei2pif) |)2df = 12( 12 ) (n (s (n) e(i2pifn)))m (s (n)ei2pifm) df
=
(n,m)
(s (n) s (n)
12
( 12 )ei2pif(mn)df
)(16)
Using the orthogonality relation (12), the integral equals (m n), where (n) is the unit sample6. Thus,the double sum collapses into a single sum because nonzero values occur only when n = m, giving Parseval'sTheorem as a result. We term
n
(s2 (n)
)the energy in the discrete-time signal s (n) in spite of the fact thatdiscrete-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) pTs (t), where theduration of the component pulses in pTs (t) is . How is the discrete-time signal energy related tothe total energy contained in s (t)? Assume the signal is bandlimited and that the sampling ratewas chosen appropriate to the Sampling Theorem's conditions.
5
"Discrete-Time Fourier Transform Properties"
6
"Discrete-Time Signals and Systems", Figure 2: Unit sample
http://cnx.org/content/m10247/2.31/
-
Connexions module: m10247 7
Solutions to Exercises in this Module
Solution to Exercise 1 (p. 1)
S(ei2pi(f+1)
)=
n=
(s (n) e(i2pi(f+1)n)
)=
n=
(e(i2pin)s (n) e(i2pifn)
)=
n=
(s (n) e(i2pifn)
)= S
(ei2pif
) (17)Solution to Exercise 2 (p. 4)
N+n01n=n0
(n)N+n01n=n0
(n) = N+n0 n0
which, after manipulation, yields the geometric sum formula.
Solution to Exercise 3 (p. 6)
If the sampling frequency exceeds the Nyquist frequency, the spectrum of the samples equals the analog
spectrum, but over the normalized analog frequency fT . Thus, the energy in the sampled signal equals theoriginal signal's energy multiplied by T .
http://cnx.org/content/m10247/2.31/
-
Connexions module: m0502 1
Discrete Fourier Transform
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
1
? 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
2
is a sum, which conceptually can be easily computed save for two issues.
Signal duration. The sum extends over the signal's duration, which must be nite to compute thesignal'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 variableis continuous: It may only need to span one period, like
[ 12 , 12] or [0, 1], but the DTFT formula as itstands 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 ).We thus dene the discrete Fourier transform (DFT) to be
Discrete Fourier transform
k, k {k, . . . ,K 1} :(S (k) =
N1n=0
S (n) e(i)2pinkK
)(1)
Here, S (k) is shorthand for S(ei2pi
kK
).
Version 2.5: May 9, 2005 7:41 pm GMT-5
http://creativecommons.org/licenses/by/1.0
1
"Analyzing the Spectrum of Speech", Figure 1: spectrogram
2
"Discrete-Time Fourier Transform(DTFT)", (1) : Fourier Transform
http://cnx.org/content/m0502/2.5/
-
Connexions module: m10783 1
The Fast Fourier Transform (FFT)
Justin Romberg
This work is produced by The Connexions Project and licensed under the
Creative Commons Attribution License
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 theactual FFT algorithm, some of its implications for the DFT, and a speed comparison to drive home the
importance of this powerful algorithm.
2 Deriving the FFT
To derive the FFT, we assume that the signal's duration is a power of two: N = 2l . Consider what happensto the even-numbered and odd-numbered elements of the sequence in the DFT calculation.
S (k) = s (0) + s (2) e(i)2pi2kN + + s (N 2) e(i) 2pi(N2)kN +
s (1) e(i)2pikN + s (3) e(i)
2pi(2+1)kN + + s (N 1) e(i) 2pi(N2+1)kN =
s (0) + s (2) e(i) 2pikN
2 + + s (N 2) e(i)2pi(N2 1)k
N2 +s (1) + s (3) e(i) 2pikN2 + + s (N 1) e(i) 2pi(N2 1)kN2
e(i2pik)N
(1)
Each term in square brackets has the form of a
N2 -length DFT. The rst one is a DFT of the even-
numbered elements, and the second of the odd-numbered elements. The rst DFT is combined with the
second multiplied by the complex exponential e(i2pik)
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 rangebetween 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
made in the half-length transforms and combines them through additions and the multiplication by e(i2pik)
N
Version 2.7: Jul 29, 2010 2:46 pm GMT-5
http://creativecommons.org/licenses/by/1.0
1
"Fast Fourier Transform (FFT)"
http://cnx.org/content/m10783/2.7/
-
Connexions module: m10783 2
, which is not periodic over
N2 , to rewrite the length-N DFT. Figure 1 (Length-8 DFT decomposition)
illustrates this decomposition. As it stands, we now compute two length-
N2 transforms (complexity 2O
(N2
4
)), multiply one of them by the complex exponential (complexity O (N) ), and add the results (complexityO (N) ). At this point, the total complexity is still dominated by the half-length DFT calculations, but theproportionality coecient has been reduced.
Now for the fun. Because N = 2l , each of the half-length transforms can be reduced to two quarter-lengthtransforms, 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 8N4 =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 log2N , the complexity of the FFT is O (N logN) .
Length-8 DFT decomposition
(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 length-
http://cnx.org/content/m10783/2.7/
-
Connexions module: m10783 3
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(ipi) meansnegating 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 log2N = 3 stages,making the number of basic computations
3N2 log2N 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 decom-
position) aren't quite the same. Why not? How is the ordering determined?
2.1 FFT and the DFT
We now have a way of computing the spectrum for an arbitrary signal: The Discrete Fourier Transform
(DFT)
2
computes the spectrum at N equally spaced frequencies from a length- N sequence. An issue thatnever arises in analog "computation," like that performed by a circuit, is how much work it takes to perform
the signal processing operation such as ltering. In computation, this consideration translates to the number
of basic computational steps required to perform the needed processing. The number of steps, known as
the complexity, becomes equivalent to how long the computation takes (how long must we wait for an
answer). Complexity is not so much tied to specic computers or programming languages but to how many
steps are required on any computer. Thus, a procedure's stated complexity says that the time taken will be
proportional to some function of the amount of data used in the computation and the amount demanded.
For example, consider the formula for the discrete Fourier transform. For each frequency we chose, we
must multiply each signal value by a complex number and add together the results. For a real-valued signal,
2
"Discrete Fourier Transform", (1) : Discrete Fourier transform
http://cnx.org/content/m10783/2.7/
-
Connexions module: m10783 4
each real-times-complex multiplication requires two real multiplications, meaning we have 2N multiplicationsto perform. To add the results together, we must keep the real and imaginary parts separate. Adding Nnumbers requires N 1 additions. Consequently, each frequency requires 2N + 2 (N 1) = 4N 2 basiccomputational 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 4N2 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(N2)computational procedure. This notation is read "order N -squared". Thus, if we doublethe 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 ques-
tions emerge. First of all, the spectra of such signals have conjugate symmetry, meaning that
negative frequency components (k =[N2 + 1, ..., N + 1
]in the DFT
3
) 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 insteadof N ; now what is the complexity?
3 Speed Comparison
How much better is O(NlogN) than O( N2)?
Figure 3: This gure shows how much slower the computation time of an O(NlogN) process grows.
N 10 100 1000 106 109
N2 100 104 106 1012 1018
N logN 1 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( N2) 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/m10783/2.7/
-
Connexions module: m10783 5
note: N = 1million is not unreasonable.
Example 1
3 megapixel digital camera spits out 3106 numbers for each picture. So for two N point sequencesf [n] and h [n]. If computing (f [n]~ h [n]) directly: O( N2) 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), thenumber 18 is less so ( 2132 ), and 17 not at all (it's prime). In over thirty years of Fourier transformalgorithm 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/
-
Connexions module: m10783 6
Solutions to Exercises in this Module
Solution to Exercise 1 (p. 3)
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.
Solution to Exercise 2 (p. 4)
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/