Finite Length Discrete Fourier Transform
Finite Length Discrete Fourier Transform
Transform
1
!
1, n = 0, 1, · · · , N − 1
wR [n] =
0, otherwise
x0 [n] = x[n]wR [n] is just the samples of x[n] between n = 0 and n = N − 1.
x0 [n] is 0 everywhere else. Therefore, it is defined ∀n, and we can take its
DTFT:
∞
" ∞
" N
" −1
−jΩn −jΩn
X0 (Ω) = DTFT(x0 [n]) = x0 [n]e = x[n]wR [n]e = x[n]e−jΩn
n=−∞ n=−∞ n=0
So,
N
" −1 N
" −1
X0 (Ω) = x[n]e−jΩn = x0 [n]e−jΩn
n=0 n=0
as we saw before.
Let’s say now that we want to sample X0 (Ω) (which is continuous and
periodic with period 2π) so we store it on a computer.
Sample X0 (Ω):
Assume we want 8 points in frequency – then sample X0 (Ω) at 8 uniformly
spaced points on the unit circle:
2
If we let k = N, what happens? If k = N, we get repetition of the points
we sampled so only N samples are unique.
Define Discrete Fourier Transform (DFT) as
2πk
X[k] = X0 ( )
N
for Ω = 2πk
N
, k = 0, 1, . . . , N − 1, i.e. only look at the N distinct sampled
frequencies of X0 (Ω).
Significant Observations
1. The resolution of the samples of the frequency spectrum is 2π
N
since we
sample the spectrum at points that are spaced 2π N
apart in frequency,
that is, ∆Ω = 2π
N
.
2. If we looked at the samples of X0 (Ω) for all k = −∞ to ∞ for frequen-
cies 2πk
N
, we would get the closely related Discrete Fourier Series (DFS)
which is of course periodic with period N since X0 (Ω) is periodic.
3. If x is a periodic signal with period N, as we saw that DFS was suf-
ficient to construct the DTFT of the signal. In other words, the DFT
procedure approximates a signal with a periodic approximation of itself.
Now
2πk
X[k] = X0 (Ω)|Ω = , k = 0, 1, · · · , N − 1
N
N
" −1
= x[n]e−jΩn |Ω= 2πk ,k=0,1,···,N −1
N
n=0
N
" −1
2πkn
= x[n]e−j N , k = 0, 1, · · · , N − 1
n=0
3
Ex.
Find
N
" −1 N
" −1
−j2πk
(e N )n = W kn
n=0 n=0
4
Ex.
!
1, n=0
x[n] =
0, n = 1, . . . , 7
Find X[k], k = 0, 1, . . . , 7.
5
Given y[n] = δ[n − 2] and N = 8, find Y [k].
6
Ex. x[n] = cWN−pn , n = 0, 1, . . . , N − 1,
2π
p is an integer with p ∈ [0, 1, . . . , N − 1] and WN = e−j N (as usual), find
its DFT.
7
Synthesis: INVERSE DFT
How can we recover x[n] from X[k]?
Synthesis formula is
−1
1 N"
x[n] = X[k]WN−kn , n = 0, 1, . . . , N − 1
N k=0
−1 N −1
1 N" "
x[n] = x[l]WNkl WN−kn
N k=0 l=0
−1 −1
1 N" N
" k(l−n)
= x[l] WN
N l=0 k=0
Ex.
N
" −1
k(l−n)
WN =?
k=0
8
ORTHOGONALITY OF EXPONENTIALS AGAIN!
So,
N −1
!
" k(l−n) N, l = n
WN =
k=0
̸ n
0, l =
and
−1 −1 −1
1 N" N
" k(l−n) 1 N"
x[n] = x[l] WN = x[l]Nδ[n − l]
N l=0 k=0
N l=0
1
= (Nx[n]) = x[n]
N
Ex. Find the IDFT of X[k] = 1, k = 0, 1, . . . , 7.
9
Ex. Given x[n] = δ[n] + 2δ[n − 1] + 3δ[n − 2] + δ[n − 3] and N = 4, find
X[k].
10
Ex. Given X[k] = 2δ[k] + 2δ[k − 2] and N = 4, find x[n].
11
Selected DFT Properties
1. Linearity.
2. Time shift.
x[n − n0 ]mod N
↔ WNkn0 X[k]
3. Frequency shift.
4. Multiplication.
1
x1 [n]x2 [n] ↔ X1 [k] ⊗ X2 [k]
N
5. Circular convolution.
6. Real/Even.
xe [n] ↔ A[k]
xo [n] ↔ jB[k]
12
Fast Fourier Transform
The work of Cooley and Tukey showed how to calculate the DFT with com-
plexity N log N (called the Fast Fourier Transform) instead of complexity
N 2 using the direct algorithm. The fft command that you use in MATLAB
implements a Fast Fourier Transform.
Examine:
N
" −1
X[k] = x[n]W kn
n=0
However, the FFT would only require about 5000, a substantial savings
in complexity (the actual calculation is N2 log2 N).
N
The primary idea is to split up the size-N DFT into 2
DFTs of length 2
each.
You split the sum into 2 subsequences of length N2 and continue all the
way down until you have N2 subsequences of length 2.
13
First break x[n] into even and odd subsequences:
" "
X[k] = x[n]W kn + x[n]W kn
neven nodd
N N
−1 −1
"
2 "
2
2mk
X[k] = x[2m]W + x[2m + 1]W k(2m+1) =
m=0 m=0
N N
−1 −1
"
2 "
2
2 mk k
x[2m](W ) +W x[2m + 1](W 2 )mk =
m=0 m=0
Xe [k] + W k Xo [k]
N
Xe [k] and Xo [k] are both the DFT of a 2
point sequence.
N
Now break up the size 2
subsequences in half by letting m = 2p:
N N
−1 −1
"
4 "
4
4 kp 2k
Xe [k] = x[4p](W ) +W x[4p + 2](W 4 )kp =
p=0 p=0
The first subsequence here is the terms x[0], x[4], . . . and the second is
x[2], x[6], . . . .
14
Also, we have that:
N
WN2 = −1
1
"
Y [k] = y[n]W2kn = y[0] + W2k y[1]
n=0
j2π
W2 = e− 2 = e−jπ = −1
So we get,
15
Ex.
This was a problem I had on a DSP final exam in 1984:
Express the DFT of the 9-point sequence {x[0], x[1], . . . , x[8]} in terms of
the DFTs of 3-point sequences {x[0], x[3], x[6]}, {x[1], x[4], x[7]}, and {x[2], x[5], x[8]}
We start with:
2
" 2
" 2
"
(3m+1)k (3m+2)k
X[k] = x[3m]W93mk + x[3m + 1]W9 + x[3m + 2]W9
m=0 m=0 m=0
16
Applications of the DFT
Linear Convolution
You can use an FFT in MATLAB to compute linear convolution. If you
don’t use a sufficient number of points in the DFT, you will get overlap.
CIRCULAR CONVOLUTION
Since DFTs are a limited length sequence, convolution is done mod N ⇒
circular convolution.
N
" −1
x1 [n] ⊗ x2 [n] = x1 [p]x2 [n − p]mod N
p=0
That is, when we flip and shift the sequence x2 [n], we do it mod N.
17
Ex. Find x1 [n] ⊗ x2 [n] = z[n].
18
Ex. N = 8, find x1 [n] ⊗ x2 [n] = y[n].
19
Ex. Find y[n] = x[n] ⊗ x[n].
20
Overview of Chapters 3, 4, and 5
Fourier Analysis for Discrete-Time Signals
1. DTFT for infinite length sequences:
continuous frequency, periodic with period 2π,
"
X(Ω) = x[n]e−jΩn
n
where
2πk
ak = X0 ( )
N
3. DFT for a finite length data
discrete frequency
Take DTFT of windowed infinite length sequence and then sample at
discrete frequencies,
2πk
Ω= , k = 0, 1, . . . , N − 1
N
N discrete frequencies since exponential is periodic.
N
" −1 N
" −1
2πkn
X[k] = x[n]e−j N = x[n]WNkn
n=0 n=0
Orthogonality of Exponentials:
N
" −1
WNkn = Nδ[k]
n=0
21