the Discrete Fourier Transform (DFT)

Double CLICK on Right Brackets to expand the Sections
3. Fourier Analysis of Discrete Time Signals
à 3.3 Expansion of Finite Length Signals:
the Discrete Fourier Transform (DFT)
In all practical applications, the data we analyze has finite length. In other words we collect a data set
x@nD , with n = 0, ..., N - 1 and we want to determine the frequencies present in the data set. The
data sequence x@nD in general is stored in memory (or in a disk or tape or any storage device) ready to
be analyzed.
Since the data has finite length, and we assume the beginning of the index is at n = 0 (it does not have to
be this way but it is convenient!), we can look at the sequence x@0D, x@1D, ..., x@N - 1D as one
period of a periodic sequence with period N.
Therefore we can expand it in Discrete Fourier Series as we did in the previous section. In this setting
the expansion is identical to the DFS but it takes the name of Discrete Fourier Transform (DFT). It is
defined as
N kn ,
X@kD = DFT 8x@nD< = S x@nD e-j €€€€€€€
N-1
x@nD = IDFT 8X@kD< =
n=0
N-1
1
€€€N S
k=0
2p
X@kD e+j
2p
€€€€
N€€€ kn ,
k = 0, ..., N - 1
n = 0, ..., N - 1
The meaning of this fact is that any finite sequence x@nD of length N can be expanded in terms of complex exponentials ejwn with frequencies
w = 0, 2 p • N, ..., k2p • N, ..., HN - 1L 2 p • N.
Example: Consider the finite length signal x@nD shown in Figure 3.3.1 below. Comparing it with the
periodic signal in figure 3.2.1 in the previous subsection, we see that it is one period of a periodic signal. Therefore the DFT of this signal is the same as the DFS of the periodic signal shown in Figure 3.2.2.
2
Unit3.nb
x[n]
1
4
9
n
Figure 3.3.1: Finite Length Signal x@nD
The Discrete Fourier Transform (DFT) is the only one in the Fourier family which is computable numerically and it is available in any respectable Signal Processing software package, although computed by its
efficient implementation, the Fast Fourier Transform (FFT).
In order to be able to give some sense to a DFT plot, let us just mention one property of the DFT:
IF x@nD is REAL for all n = 0, ..., N - 1, and X@kD = DFT 8x@nD<,
THEN
*
X@N - kD = X @kD, for all k = 0, ..., N - 1
This means that, for real signals, the magnitude È X@kD Èis symmetric around the middle point N • 2.
Homework Problems: Problem 7.3
See if you are following. Click HERE for a Question (not graded)
3.3.1 DFT of Complex Exponentials and Sinusoids
One of the applications of the DFT is the detection of sinusoidal components on a given data set. In
particular, if we go back to the fact that the DFT is associated to the expansion of a finite length signal as
1
j Hk €€€€N€€€ L n , for n = 0, ..., N - 1
x@nD = €€€
N S X@kD e
N-1
2p
2p
2p
in terms of complex exponentials of frequencies 0, ..., k €€€€€
N € , ..., HN - 1L €€€€€
N € we can conjw
n
0
vince ourselves that a finite length signal x@nD = e
with n = 0, .., N - 1, is going to have a
2p
DFT with a "peak" corresponding to a frequency k0 €€€€€
€
N close to w0 .
k=0
In fact let us apply the formula of the DFT to the complex exponential x@nD = ejw0 n , with
n = 0, ..., N - 1 . Then we obtain
Unit3.nb
3
2p
X@kD = S ejw0 n e-j Hk €€€€N€€€ L n = W Hk €€€€€
€ - w0L
N
N-1
where W HwL is defined as
2p
n=0
1-e
W HwL = S e-jwn = €€€€€€€€
€€€€
1-e-jw
N-1
-jwN
n=0
based on the geometric series. In order to better understand how this function looks like, let us rewrite it
as follows:
e
e
-e
2
2 €€€€€ €€€€€€€€€€€€€€€
W HwL = €€€€€€€€
€€ €€€€€€€€€€€€€€€€
€€€ = e-jw €€€€€€€€
w
sin H €€€
€L
e-j €€€€
ej €€€€ -e-j €€€€
N
-jw €€€€
2
w
2
N
jw €€€€
2
w
2
wN
sin H €€€€€€
L
HN-1L
N
-jw €€€€
2
w
2
2
This is a periodic function with period 2 p , in the sense that
W HwL = W Hw + 2 pL for all w
2
|, and figure 3.3.2 below shows the
Of particular interest to us is the magnitude È W HwL È =| €€€€€€€€
€€€€€€€
w
L
sin H €€€€
wN€€ L
sin H €€€€
2
plot of one period, in the interval -p £ w £ +p . In this example we chose N = 10 .
Figure 3.3.2: Plot of of one period of È W HwL È, for N = 10.
Notice that this function È W HwL È has a "main lobe" with maximum value È W H0L È = N, and extend2p
2p
ing between w = - €€€€€
N € to w = + €€€€€
N € , corresponding to È W HwL È = 0. Thus the main lobe has a width
4
p
of Dw = €€€€€€
N .
We can see why this is important, by going back to the DFT of x@nD = ejw0 n . In fact we can see that its
DFT can be written as
È X@kD È = È W Hw - w0L Èw=k
2p
€€€€
N€€€
where X@kD = DFT 8ejw0 n , n = 0, ..., N - 1<, k = 0, ..., N - 1.
The maximum of È X@kD È occurs at the index k0 such that
4
Unit3.nb
2p
2p
Hk0 - 1L €€€€€
N € £ w0 £ Hk0 + 1L €€€€€
N€
Therefore, given the plot of È X@kD È , the magnitude of the DFT, if there is a distinct maximum at an
index k0 it means that the data has a complex exponential at a frequency w0 within the bounds given
above.
Example: a data file x@nD has N = 100 points, and has a DFT whose magnitude is given as in figure
3.3.3 below.
Figure 3.3.3: Plot of È X@kD È, for k = 0, ..., 99 in the example
Notice that there is a distinct maximum which occurs at k = 7. This means that the data has a complex
exponential at a frequency
2p
2p
6 €€€€€€
100€ £ w0 £ 8 €€€€€€
100€
In other words the frequency of the complex exponential is within the interval 0.12 p and 0.16 p . The
larger the data set N the more precise is the estimate of the frequency.
If the data has a sinusoid, as for example
x@nD = cos Hw0 nL, n = 0, ..., N - 1
then we know that we can break it into two complex exponentials
1
1
jw0 n + €€€
-jw0 n , for n - 0, ..., N - 1
x@nD = €€€
2 e
2 e
Unit3.nb
5
Taking the DFT we obtain
1
1
2p
È X@kD È = È €€€
2 W Hw - w0 L + €€€
2 W Hw + w0 L Èw=k €€€€N€€€ for k = 0, ..., N - 1
Since the frequency w0 is positive, the main lobe of the term W Hw + w0L is centered at the nagative
frequency w0 . As a consequence, using the fact that W HwL is periodic with period 2 p, it is better to
write
1
1
2p
È X@kD È = È €€€
2 W Hw - w0 L + €€€
2 W Hw - H2 p - w0 LL Èw=k €€€€N€€€
for k = 0, ..., N - 1 . As a consequence, the DFT of a sinusoid of frequency 0 £ w0 < p, of a finite
length N has two peaks: one at k0 and one at N - k0 where again
2p
2p
Hk0 - 1L €€€€€
€ £ w0 £ Hk0 + 1L €€€€€
€
N
N
N
N
The first peak is within the interval 0 £ k0 < €€€
2 while the second peak is at €€€
2 < N - k0 £ N - 1
Example: a data file x@nD has N = 100 points, and has a DFT whose magnitude is given as in figure
3.3.3 below.
Figure 3.3.4: Plot of È X@kD È, k = 0, ..., 99 in the example
There are two peaks: one at k0 = 7 and one at 100 - k0 = 93 . The frequency of the sinusoid is again
within the interval
6
Unit3.nb
2p
2p
6 €€€€€€
100€ £ w0 £ 8 €€€€€€
100€
or, in other words, the frequency is within 0.12 p and 0.16 p .
N
The frequency we see within the interval 0 £ k0 < €€€
2 corresponde to the actual frequency 0 £ w0 < p ,
while the other frequency at N - k0 corresponds to the negative frequency and it does not provide any
information.
Homework Problems: Problems 7.4 -7.6
See if you are following. Click HERE for a Question (not graded)