Upload
xp2009
View
58
Download
2
Embed Size (px)
DESCRIPTION
dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp
Citation preview
CHAPTER 5:
DISCRETE FOURIER TRANSFORM (DFT)
Lesson #19: DTFT of DT periodic signals
Lesson #20: DFT and Inverse DFT
Lesson #21: DFT properties
Lesson #22: Fast Fourier Transform (FFT)
Lesson #23: Applications of DFT/FFT
Lesson #24: Using of DFT/FFT
Lecture #19
DTFT of periodic signals
1. Review of Fourier Transforms (FT)
2. Fourier Series expansions
3. DTFT of periodic signals
FT of CT periodic signals
Tdtetx
Taeatx
tjk
T
k
tjk
k
k
2;)(
1;)( 0
00
Discrete and aperiodic in frequency domain
Continuous and periodic in time domain
FT of CT aperiodic signals
Continuous and aperiodic in time domain
1
Continuous and aperiodic in frequency domain
FT of DT aperiodic signals
Discrete and aperiodic in time domain
Continuous and periodic in frequency with period 2π
Recapitulation
Can guess?
Lecture #19
DTFT of periodic signals
1. Review of Fourier Transforms (FT)
2. Fourier Series expansions
3. DTFT of periodic signals
Nn
njk
k
njk
Nk
k enxN
aeanx 00 ][1
;][ N
20
dtetxT
aeatxtjk
T
k
tjk
k
k00 )(
1;)(
• CT periodic signals with period T:
• DT periodic signals with period N:
Note: finite sums over an interval length of one periodic N
n)Nk(jn
N
2)Nk(jn
N
2jk
njk 00 eeee
T
20
Fourier Series expansion
Given a DT periodic signals with period N:
Example of Fourier Series expansion
[ ] [ ]k
p n n kN
N
1e]n[p
N
1a
1N
0n
N/n2jk
k
. . . -2N -N 0 N 2N . . . . .
1
0
2
][N
k
nN
jk
keanp
Lecture #19
DTFT of periodic signals
1. Review of Fourier Transforms (FT)
2. Fourier Series expansions
3. DTFT of periodic signals
• CT periodic signals with period T:
• DT periodic signals with period N:
DTFT of periodic signals
)k(a2)(Xea)t(x0
kk
Ftjk
kk
0
)k(a2)(X]n[x0
kk
F
. . . -2N -N 0 N 2N . . . . . . . . n
Example of calculating DTFT of
periodic signals
kk0k
N
2k
N
2ka2)(P
2π/N 2π/N 2π/N 2π/N 2π/N
. . . -4π/N -2π/N 0 2π/N 4π/N . . . . Ω
Height = 1
Spacing = N
Height = 2π/N
Spacing = 2π/N
Another approach to get DTFT of
periodic signals
0
[ ] 0 1[ ]
0 otherwise
x n n Nx n
0 N-1
x(n) is periodic signal; x0(n) is a part of x(n) that is repeated
Another approach (cont)
0
[ ] 0 1[ ]
0 otherwise
x n n Nx n
0 0 0[ ] [ ] [ ] [ ] [ ] [ ]k k k
x n x n kN x n n kN x n n kN
p(n) in previous example
0 0[ ] [ ] [ ] ( ) ( ) ( )F
x n x n p n X P X
Another approach (cont)
0 0[ ] [ ] [ ] ( ) ( ) ( )F
x n x n p n X P X
k
k
Nk
NkX
N
Nk
NXX
)2
()2
(2
)2
(2
)()(
0
0
It has N distinct values at k = 0, 1, …, N-1
Inverse DTFT
1
0
2
0
2
0
0
2
0
0
2
0
1
)2
(1
)2
()2
(1
)2
()2
(2
2
1
)(2
1][)(
N
k
N
nkj
k
nj
nj
k
nj
eN
kXN
deN
kN
kXN
deN
kN
kXN
deXnxXDFT
This is obtained from this property of the impulse:
elsewhere
btatfdttttf
b
a0
)()()(
00
0
Summary
Procedure to calculate DTFT of
periodic signals
Step 1:
Start with x0(n) – one period of x(n), with zero everywhere else
Step 2:
Find the DTFT X0(Ω) of the signal x0[n] above
Step 3:
Find X0(Ω) at N equally spacing frequency points X0(k2π/N)
Step 4:
Obtain the DTFT of x(n): k N
kN
kXN
X )2
()2
(2
)( 0
Example of calculating DTFT of
periodic signals
33
0
00 21)()( jj
n
nj eeenxX
k = 0 X0(0) = 4; k = 1 X0(1) = 1+j
k = 2 X0(2) = -2; k = 3 X0(3) = 1-j
0 1 2 3
Example (cont)
Example (cont)
a) Draw the magnitude plot of the FT of a CT sinusoid x(t), that
has a frequency of 24 Hz
b) Sample this signal x(t) at 40 Hz. Draw the magnitude plot of
the FT of the sampled signal
c) Reconstruct a CT signal from the samples above with a LPF, it
will look like a CT sinusoid of what frequency?
d) Consider DT signal that is obtained by the sampling x(t) at a
sampling frequency of 40 Hz is x(n). Is x(n) a periodic signal?
If yes, what is its period?
e) Specify the DTFT of the DT signal x(n).
DTFT and DFS example
a) Draw the magnitude plot of the FT of a CT sinusoid x(t), that has
a frequency of 24 Hz
The FT of a sinusoidal has nonzero values only at certain points
DTFT and DFS examples
-24 24 f [Hz]
-48π 48π ω [rad/s]
b) Sample this signal x(t) at 40 Hz. Draw the magnitude plot of the
FT of the sampled signal
Sampled signal FT magnitude = copies of unsampled signal FT
magnitude; each copy is centered at k40(Hz) or k80π(rad/s)
DTFT and DFS examples
-64 -56 -24 -16 0 16 24 40 56 64 f[Hz]
-128π -48π -32π 32π 48π 80π 112π
ω[rad/s]
fs = 40Hz fs = 40Hz
8Hz
c) Reconstruct a CT signal from the samples above with a LPF, it will
look like a CT sinusoid of what frequency?
The unit circle represents the scale of frequency range for a
signal sampled at 40Hz the reconstructed signal looks like
16Hz.
DTFT and DFS examples
20
24
16
0 16 24 40 56 64 f[Hz]
32π 48π 80π 112π ω[rad/s]
8Hz
d) Consider DT signal that is obtained by the sampling x(t) at a
sampling frequency of 40 Hz is x(n). Is x(n) a periodic signal? If
yes, what is its period?
The unsampled signal: x(t) = cos(2π.24t)
The sampled signal:
x[n] = cos(2π.24.(1/40)t) = cos(6π/5)n = cos (4π/5)n
The sampled signal is periodic with N = 5
DTFT and DFS examples
e) Specify the DTFT of the DT signal x(n).
DTFT and DFS examples
Lecture #20
DFT and inverse DFT
1. DFT and inverse DFT formulas
2. DFT and inverse DFT examples
3. Frequency resolution of the DFT
DFT to the rescue!
Both CTFT and DTFT produce continuous function of
frequency can’t calculate an infinite continuum of frequencies
using a computer
Most real-world data is not in the form like anu(n)
DFT can be used as a FT approximation that can calculate a finite
set of discrete-frequency spectrum values from a finite set of
discrete-time samples of an analog signal
Could we calculate the frequency spectrum of a signal
using a digital computer with CTFT/DTFT?
Building the DFT formula
“Window” x(n) is like multiplying
the signal by the finite length
rectangular window
Discrete time
signal x(n)
Continuous time
signal x(t)
Discrete time
signal x0(n)
Finite length
sample
window
Building the DFT formula (cont)
Discrete time
signal x(n)
Continuous time
signal x(t)
Discrete time
signal x0(n)
Finite length
sample
window
DTFT
1
0
000 ][][)(N
n
nj
n
nj enxenxX
Building the DFT formula (cont)
Discrete time
signal x(n)
Continuous time
signal x(t)
Discrete time
signal x0(n)
Finite length
sample
window
DTFT
Sample
at N
values
around
the unit
circle
Discrete Fourier Transform DFT X(k)
Discrete + periodic with period N
X0(Ω)
Continuous + periodic
with period 2π
Notation conventions
Notation conventions (cont)
DFT and inverse DFT formulas
Notation
You only have to store N points
N
2j
N eW
Lecture #20
DFT and inverse DFT
1. DFT and inverse DFT formulas
2. DFT and inverse DFT examples
3. Frequency resolution of the DFT
DFT and IDFT examples
Ex.1. Find the DFT of x(n) = 1, n = 0, 1, 2, …, (N-1)
k = 0 X(k) = X(0) = N
k ≠ 0 X(k) = 0
DFT and IDFT examples
Ex.2. Given y(n) = δ(n-2) and N = 8, find Y(k)
DFT and IDFT examples
Ex.3. Find the IDFT of X(k) = 1, k = 0, 1, …, 7.
DFT and IDFT examples
Ex.4. Given x(n) = δ(n) + 2δ(n-1) +3δ(n-2) + δ(n-3) and
N = 4. Find X(k).
DFT and IDFT examples
Ex.5. Given X(k) = 2δ(k) + 2δ(k-2) and N = 4. Find x(n).
DFT in matrix forms
)1)(1()1(21
)1(21
1
0
1
1
1111
]1[
]1[
]0[
]1[
]1[
]0[
:'
1,...,1,0][][
NN
N
N
N
N
N
N
NNN
N
NN
N
n
kn
N
WWW
WWWW
NX
X
X
X
Nx
x
x
x
definesLet
NkWnxkX
The N-point DFT may be expressed in matrix form as:
XN = WNxN
IDFT in matrix forms
)1)(1()1(21
)1(21
1
0
1
1
1111
]1[
]1[
]0[
]1[
]1[
]0[
:'
1,...,1,0][1
][
NN
N
N
N
N
N
N
NNN
N
NN
N
k
kn
N
WWW
WWWW
NX
X
X
X
Nx
x
x
x
definesLet
NnWkXN
nx
The N-point DFT may be expressed in matrix form as:
matrixidentityI
NIWW
XWN
XWx
N
NNN
NNNNN
:
1
*
*1
Example of calculation of DFT in matrix form
Find DFT of the signal
x[n] =
δ[n-1] + 2δ[n-2] + 3δ[n-3]
j
jxWXThen
jj
jj
WWW
WWW
WWWW
x
definesLet
22
2
22
6
.
11
1111
11
1111
1
1
1
1111
3
2
1
0
:'
444
9
4
6
4
3
4
6
4
4
4
2
4
3
4
2
4
1
4
4
4
Lecture #20
DFT and inverse DFT
1. DFT and inverse DFT formulas
2. DFT and inverse DFT examples
3. Frequency resolution of the DFT
Discrete frequency spectrum computed from DFT has the
spacing between frequency samples of:
Frequency resolution of the DFT
N
ff s
N
2
The choice of N determines the resolution of the frequency
spectrum, or vice-versa
To obtain the adequate resolution:
1. Increasing of the duration of data input to the DFT
2. Zero padding, which adds no new information, but effects a better
interpolator
Examples of N = 5 and N = 15
Examples of N = 15 and N = 30
Lecture #21
DFT properties
1. Periodicity and Linearity
2. Circular time shift
3. Circular frequency shift
4. Circular convolution
5. Multiplication
6. Parseval’s theorem
DFT properties
x(n)
Finite length
xp(n)
Periodic
N periodic extension
truncate
N periodic extension
truncate
X(k)
Finite length Xp(k)
Periodic
DFT
DFT
-1
Xp(Ω)
Periodic
DTFT
DTFT-1
DFT properties
x(n)
Finite length
xp(n)
Periodic
N periodic extension
truncate
N periodic extension
truncate
X(k)
Finite length Xp(k)
Periodic
DFT
DFT
-1
Xp(Ω)
Periodic
DTFT
DTFT-1
Periodicity
x[n+N] = x[n] for all n
X[k+N] = X[k] for all k
If x[n] and X[k] are an N-point DFT pair, then
Linearity
Note: The length of x1[n] is same with the length of x2[n]
][][][][ 22112211 kXakXanxanxaDFT
Proof:
Infer from the definition formula of DFT
Lecture #21
DFT properties
1. Periodicity and Linearity
2. Circular time shift
3. Circular frequency shift
4. Circular convolution
5. Multiplication
6. Parseval’s theorem
Circular time shift property
]k[XW]mn[x kmDFT
Proof:
Infer from the relation between DFT and DTFT
][][)(
:2
)(][
2
kXWkXeXe
Nk
Xemnx
kmm
Njk
mj
mjDTFT
Circular
time
shift
Circular shift by m is the same as a shift by m modulo N
x(n)
xp(n)
xp(n+2)
x(n+2)
Lecture #21
DFT properties
1. Periodicity and Linearity
2. Circular time shift
3. Circular frequency shift
4. Circular convolution
5. Multiplication
6. Parseval’s theorem
Circular frequency shift property
][][ ln lkXWnxDFT
Proof:
Similar to the circular time shift property
Lecture #21
DFT properties
1. Periodicity and Linearity
2. Circular time shift
3. Circular frequency shift
4. Circular convolution
5. Multiplication
6. Parseval’s theorem
Circular convolution property
The non-zero length of x1(n) and x2(n) can be no longer
than N
The shift operation is circular shift
The flip operation is circular flip
1
0
212121 ][][][][][].[N
p
DFT
pnxpxnxnxkXkX
The circular convolution is not the linear convolution in chapter 2
Direct method to calculate circular
convolution
1. Draw a circle with N values of x(n) with N equally spaced angles
in a counterclockwise direction.
2. Draw a smaller radius circle with N values of h(n) with equally
spaced angles in a clockwise direction. Superimpose the centers of 2
circles, and have h(0) in front of x(0).
3. Calculate y(0) by multiplying the corresponding values on each
radial line, and then adding the products.
4. Find succeeding values of y(n) in the same way after rotating the
inner disk counterclockwise through the angle 2πk/N
Example to calculate circular convolution
Evaluate the circular convolution, y(n) of 2 signals:
x1(n) = [ 1 2 3 4 ]; x2(n) = [ 0 1 2 3 ]
1
2
3
4 0
1
2
3
y(0) = 16
1
2
3
4 1
2
3
0
y(1) = 18
Example (cont)
Evaluate the circular convolution, y(n) of 2 signals:
x1(n) = [ 1 2 3 4 ]; x2(n) = [ 0 1 2 3 ]
1
2
3
4 2
3
0
1
y(2) = 16
1
2
3
4 3
0
1
2
y(3) = 10
Another method to calculate circular convolution
x1(n)
x2(n)
X1(k)
X2(k)
DFT
DFT
IDFT y(n)
Ex. x1(n) = [ 1 2 3 4 ]; x2(n) = [ 0 1 2 3 ]
X1(k) = [ 10, -2+j2, -2, -2-j2 ];
X2(k) = [ 6, -2+j2, -2, -2-j2 ];
Y(k) = X1(k).X2(k) = [ 60, -j8, 4, j8 ]
y(n) = [ 16, 18, 16, 10 ]
Lecture #21
DFT properties
1. Periodicity and Linearity
2. Circular time shift
3. Circular frequency shift
4. Circular convolution
5. Multiplication
6. Parseval’s theorem
Multiplication
The non-zero length of X1(k) and X2(k) can be no longer
than N
The shift operation is circular shift
The flip operation is circular flip
1
0
212121 ][][1
][][1
][].[N
l
DFT
lkXlXN
kXkXN
nxnx
Lecture #21
DFT properties
1. Periodicity and Linearity
2. Circular time shift
3. Circular frequency shift
4. Circular convolution
5. Multiplication
6. Parseval’s theorem
Parseval’s theorem
The general form:
Special case:
1
0
1
0
][*][1
][*][N
k
N
n
kYkXN
nynx
1
0
21
0
2 |][|1
|][|N
k
N
n
kXN
nx
Parseval’s theorem example
Given x(n) = δ(n) + 2δ(n-1) +3δ(n-2) + δ(n-3) and N = 4.
1
0
2222222
22221
0
2
154
60)121127(
4
1|][|
1
151321|][|
N
k
N
n
kXN
nx
Multiple choice questions
Ex1:
It is desired to build a sampling system which takes a
recorded orchestra music signal s(t) and converts it to a
discretely-sampled form. In order to experimentally determine
the bandwidth (in frequency) of this signal the best transform
would be
a. The Fourier transform of a continuous function or a discrete
sequence
b. The Z-transform
c. The Fourier series
d. The discrete Fourier transform
Multiple choice questions
Ex2:
A mathematical model of human speech puts out a perfectly
periodic signal for steady vowel sounds. In order to accurately
determine the harmonics of the fundamental frequency for
this mathematical model, the best transform should be
a. The Fourier transform of a continuous function or a discrete
sequence
b. The Z-transform
c. The Fourier series
d. The discrete Fourier transform
Multiple choice questions
Ex3:
A student wishes to convolve the continuous-time mathematical
functions g(t) and h(t). She/he uniformly samples these
functions, and uses a computer to get, at best, an approximate
result. Another student claims to be able to get an exact result
via a transform. She/he must be thinking of which transform
a. The Fourier transform of a continuous function or a discrete
sequence
b. The Z-transform
c. The Fourier series
d. The discrete Fourier transform
Multiple choice questions
Ex4:
A student wishes to convolve the discrete-time mathematical
functions g(n) and h(n). She/he claims to be able to get an
exact result via one of the transforms below. She/he must be
thinking of which transforms
a. The Fourier transform of a continuous function or a discrete
sequence
b. The Z-transform
c. The Fourier series
d. The discrete Fourier transform
Lecture #22
Fast Fourier Transform (FFT)
1. What is FFT?
2. The decomposition-in-time Fast Fourier
Transform algorithm (DIT-FFT)
3. The decomposition-in-frequency Fast
Fourier Transform algorithm (DIF-FFT)
Using some "tricks" and choosing the appropriate N value, the DFT
can be implemented in a very computationally efficient way – this is
the Fast Fourier Transform (FFT) - which is the basis of lots of
contemporary DSP hardware
N
2j
N eW1Nn0W]k[XN
1]n[x
1Nk0W]n[x]k[X
1N
0n
nk
N
1N
0n
nk
N
Recall DFT and IDFT definition
Nth complex root of unity:
What does it take to compute DFT or IDFT?
N2 complex multiplications for all N points of X(k) or x[n]
FFT: the algorithm to optimize the computational process by
breaking the N-point DFT into smaller DFTs
Ex.: N is a power of 2: split N-point DFT into two N/2-point DFTs,
then split each of these into two of length N/4, etc., until we
have N/2 subsequences of length 2
Cooley and Tukey (1965):
Fast Fourier Transform (FFT)
tionsmultiplicacomplex 2
log2
2N
NN
Some properties of can be exploited
Other useful properties:
Wnk
N
k andn in y periodicit ,
symmetry conjugatecomplex ,
)()(
*)(
WWW
WWWnNk
N
Nnk
N
kn
N
kn
N
nNk
N
knN
WW
WW
eWWWW
knN
kn
N
kn
N
kn
Njnkn
N
nN
N
kn
N
nN
k
N
2
2
2)
2(
oddn if ,
evenn if ,
FFT (cont)
N Co
mp
lex m
ult
iplicati
on
nu
mb
ers
FFT
Comparison of DFT and FFT efficiency
Comparison of DFT and FFT efficiency
Number of Complex multiplications Complex multiplications Speed improvement
points N in direct DFT in FFT factor
4
8
16
32
64
128
256
512
1024
16
64
256
1,024
4,096
16,384
65,536
262,144
1,048,576
4
12
32
80
192
448
1,024
2,304
5,120
4.0
5.3
8.0
12.8
21.3
36.6
64.0
113.8
204.8
Lecture #22
Fast Fourier Transform (FFT)
1. What is FFT?
2. The decomposition-in-time Fast
Fourier Transform algorithm (DIT-FFT)
3. The decomposition-in-frequency Fast
Fourier Transform algorithm (DIF-FFT)
G(k) is N/2 points DFT of the even numbered data: x(0),
x(2), x(4), …., x(N-2).
H(k) is the N/2 points DFT of the odd numbered data:
x(1), x(3), …, x(N-1).
even odd
[ ] [ ] [ ]kn kn
n n
X k x n W x n W
DIT-FFT with N as a 2-radix number
1N,...,1,0k ),k(H)k(G)k(X Wk
N
We divide X(k) into 2 parts:
2 21 1
2 (2 1)
0 0
[ ] [2 ] [2 1]
N N
mk k m
m m
X k x m W x m W
2 21 1
2 2
0 0
[2 ]( ) [2 1]( )
N N
mk k mk
m m
x m W W x m W=
2/N
)2/N/(2j2N/2j2
NWeeW
G(k) and H(k) are of length N/2; X(k) is of length N
G(k)=G(k+N/2) and H(k)=H(k+N/2)
)()(][][)(
1
0
2/
1
0
2/
22
kHkGWmhWWmgkX Wk
Nm
mk
N
k
N
m
mk
N
NN
DIT-FFT (cont)
Note:
4
k
848]k[HW]k[G]k[X
]3[HW]3[G]7[X]3[HW]3[G]3[X
]2[HW]2[G]6[X]2[HW]2[G]2[X
]1[HW]1[G]5[X]1[HW]1[G]1[X
]0[HW]0[G]4[X]0[HW]0[G]0[X
7
8
3
8
6
8
2
8
5
8
1
8
4
8
0
8
DIT-FFT of length N = 8
DFT
N = 4
DFT
N = 4
# complex multiplications are reduced: 82 = 64 2x(4)2 + 8 = 40
Signal
flow
graph
for
8-point
FFT
2424 ][][][ kHWkGkX k
DIT-FFT of length N = 4
]1[]1[]3[
]0[]0[]2[
]1[]1[]1[
]0[]0[]0[
3
4
2
4
1
4
0
4
HWGX
HWGX
HWGX
HWGX
]1[]1[]3[ 3
4 HWGX
]1[]1[]1[ 1
4 HWGX
]0[]0[]2[ 2
4 HWGX
]0[]0[]0[ 0
4 HWGX
DFT
N = 2
DFT
N = 2
W0
x[0]
x[2]
x[1]
x[3]
W1
W2
W3
# multiplications are reduced: 42 = 16 2x(2)2 + 4 = 12
DIT-FFT of length N = 2
# multiplications are
reduced: 22 = 4 0;
just 2 additions!!! x[1] - 1
x[0] X[0]
X[1]
]1[]0[]1[]0[]1[
]1[]0[]1[]0[]0[
1,10,][][
1.11.0
0.10.0
2
21
0
xxWxWxX
xxWxWxX
eWkWnxkXj
n
nk
Butterfly diagram
DFT
N = 4
DFT
N = 4
First step: split 8-point DFT into two 4-point DFTs
Example
of
8-point
FFT
0W
0W
W4
W2
W0
W0
W6
W6
W2
W4
DFT N = 2
DFT N = 2
DFT N = 2
DFT N = 2
G[0]
G[1]
G[2]
G[3]
H[0]
H[1]
H[2]
H[3]
Example
of
8-point
FFT
(cont)
Second step: split each of 4-point DFT into two 2-point DFTs
Example
of
8-point
FFT
(cont) 0W
0W
W4
W2
W0
W0
W6
W6
W2
W4
Third step: combine all signal flow graphs of step 1 and step 2
W0
W1
W2
W3
W4
W5
W6
W7
There are 3 = log28 stages; 4 butterfly diagrams in each stage
Wr+N/2
Wr+N/2 = -Wr
Wr - 1
Butterfly diagram
Now the overall computation is reduced to:
tionsmultiplicacomplex 2
log2
2N
NN
The
overall
signal
flow
graph
for
8-point
DIT-FFT
Wr - 1
In-place computation
a
b
A
B
Each butterfly takes (a,b) to produce (A,B) no need to save
(a,b) can store (A,B) in the same locations as (a,b)
We need 2N store registers to store the results at each stage and
these registers are also used throughout the computation of the
N-point DFT
The order of the input: bit-reversed order
The order of the output: natural order
Lecture #22
Fast Fourier Transform (FFT)
1. What is FFT?
2. The decomposition-in-time Fast Fourier
Transform algorithm (DIT-FFT)
3. The decomposition-in-frequency Fast
Fourier Transform algorithm (DIF-FFT)
Rewrite the second half:
DIF-FFT with N as a 2-radix number
1)2/(
0
1)2/(
0
1
)2/( 2
2)( 22
N
n
kn
N
k
N
N
n
nk
N
N
Nn
kn
N WN
nxWWN
nxWnxNN
1,...,1,0 ,)()()(1)2/(
0
1
)2/(
NkWnxWnxkXN
n
N
Nn
kn
N
kn
N
kjNNkjk
N eeWN
)1()2/)(/2(2
We divide X(k) in half – first half and second half
Since:
then
1,...,1,0 ,)2/()1()()(1)2/(
0
NkWNnxnxkXN
n
kn
N
k
DIF-FFT (cont)
12
,...,1,0 ,)2/()()12(
12
,...,1,0 ,)2/()()2(
1)2/(
0
2/
1)2/(
0
2/
NkWWNnxnxkX
NkWNnxnxkX
N
n
kn
N
n
N
N
n
kn
N
2
2/
2
NN WW
Decompose X(k) into two frequency sequences, even and odd:
Since:
then,
12
,...,1,0 ,)2/()()12(
12
,...,1,0 ,)2/()()2(
1)2/(
0
)12(
1)2/(
0
2
NkWNnxnxkX
NkWNnxnxkX
N
n
nk
N
N
n
kn
N
DIF-FFT butterfly
x[n]
x[n+N/2]
x[n] + x[n+N/2]
(x[n] - x[n+N/2])WNn
-1 WN
n
DIF-FFT of length N = 4
-1
-1
-1
-1 W41
W40
x[0] + x[2]
x[1] + x[3]
(x[0] - x[2])W40
(x[1] - x[3])W41
x[0]
x[1]
x[2]
x[3]
X[0]
X[2]
X[1]
X[3]
Lecture #23
DFT applications
1. Approximation of the Fourier Transform
of analog signals
2. Linear convolution
Approximation of Fourier Transform
Using DFT as a discrete-frequency approximation of the DTFT
and also an approximation of the CTFT
Step1. Determine the resolution ΔΩ = 2π/N required for the DFT to
be useful for its intended purpose determine N (N often = 2n)
Step 2. Determine the sampling frequency required to sample the
analog signal so as to avoid aliasing ωs ≥ 2ωM
Step 3. Accumulate N samples of the analog signal over N.T
seconds (T = 2π/ωs)
Step 4. Calculate DFT directly or using FFT algorithm
0 0.5 1 1.5 2 2.5 30
0.5
1
n
f[n]
0 1 2 3 4 50
1
2
3
omega
mag
nitu
de
Example
f(t) = rect[(t-1)/2]
F(ω) = 2sinc(ω)e-jω
Ts = 1s
%Error of sample 1 = 50%
Example
0 5 10 150
0.5
1
n
f[n]
0 5 10 15 20 25 300
1
2
3
omega
mag
nitu
de
f(t) = rect[(t-1)/2]
F(ω) = 2sinc(ω)e-jω
Ts = 0.2s
%Error of sample 1 = 10%
0 5 10 15 20 25 30 350
0.5
1
n
f[n]
0 10 20 30 40 50 60 700
1
2
3
omega
mag
nitu
de
Example
f(t) = rect[(t-1)/2]
F(ω) = 2sinc(ω)e-jω
Ts = 0.1s
%Error of sample 1 = 5%
Windowing
Source of error: truncation or “windowing” of the periodic
extension of the DT sequence implied in the DFT development
Windowing = multiplying the periodic extension of x[n] by a
rectangular function with duration N.T DFT involves a convolution
DFT = sampled(DTFT*sinc)
This multiplication causes spectrum-leakage distortion
To reduce the affect of spectrum-leakage distortion:
- Increase the sampling frequency
- Increase the number of samples
- Choose an appropriate windowing function (Hamming, Hanning)
Lecture #23
DFT applications
1. Approximation of the Fourier Transform of
analog signals
2. Linear convolution
Recall linear convolution
N1: the non-zero length of x1(n); N2: the non-zero
length of x2(n); Ny = N1 + N2 -1
The shift operation is the regular shift
The flip operation is the regular flip
p
pnxpxnxnxny ][][][*][][ 2121
Recall circular convolution
The non-zero length of x1(n) and x2(n) can be no longer
than N
The shift operation is circular shift
The flip operation is circular flip
1
0
2121 ][][][][][N
p
pnxpxnxnxny
Calculation of the linear convolution
The circular convolution of 2 sequences of length N1 and N2
can be made equal to the linear convolution of 2 sequences
by zero padding both sequences so that they both consists
of N1+N2-1 samples.
x1(n)
N1 samples
x2(n)
N2 samples
x’1(n)
x’2(n)
Zero padding
(N2-1) zeros IDFT
x1(n)*x2(n) Zero padding
(N1-1) zeros
DFT
DFT
Example of calculation of the linear convolution
x1(n) = [ 1 2 3 4 ]; x2(n) = [ 0 1 2 3 ]
x’1(n) = [ 1 2 3 4 0 0 0 ]; x’2(n) = [ 0 1 2 3 0 0 0 ]
X’1(k) = [ 10, -2.0245-j6.2240, 0.3460+j2.4791, 0.1784-j2.4220, 0.1784+j2.4220, 0.3460-j2.4791, -2.0245-j6.2240 ];
X’2(k) = [ 6, -2.5245-j4.0333, -0.1540+j2.2383, -0.3216-j1.7950, -0.3216+j1.7950, -0.1540-j2.2383, -2.5245+j4.0333];
Y’(k) = [ 60, -19.9928+j23.8775, -5.6024+j0.3927, -5.8342-j0.8644, -4.4049+j0.4585, -5.6024-j0.3927, -19.9928 +j23.8775 ]
IDFTY’(k) = y’(n) = [ 0 1 4 10 16 17 12 ]
Lecture #24
Using DFT/FFT
The response, y(n) of a filter with the impulse response, h(n)
to an input, x(n) can be calculated by using the DFT
Limitations: All sample values of the signal must be
accumulated before the process begins
Great memory
Long time delay
Not suitable for long duration input
Solution: block filtering
Filtering
Divide long input signal, x(n) into non-overlapped blocks,
xb(n) of appropriate length for FFT calculation.
Convolve each block xb(n) and h(n) to get the output,
yb(n)
Overlap-add outputs, yb(n) together to form the output
signal, y(n)
Overlap-add technique in block filtering
Example of overlap-add technique
h(n)
x(n)
Example of overlap-add technique
x0(n)
x1(n)
x2(n)
Example (cont)
y0(n)
y1(n)
y2(n)
Prob.1 Prob. 5
12.10 12.18
Prob. 2 Prob. 6
12.11 12.22
Prob. 3 Prob. 7
12.12 12.24
Prob. 4 Prob. 8
12.15 12.30
HW
Prob.9
Given signals below and their DFT-5
HW
]n[]n[s)c(
]1n[]n[x)b(
]4n[4]3n[3]2n[2]1n[]n[x)a(
2
1
1. Find y[n] so that Y[k] = X1[k].X2[k]
2. Does x3[n] exist, if S[k] = X1[k].X3[k]?
Prob.10
Prove the Parseval’s theorem
HW
1
0
1
0
][*][1
][*][N
k
N
n
kYkXN
nynx
Lecture #20
DFT applications
1. Approximation of the Fourier Transform
of analog signals
2. Convolution
3. Filtering
4. Correlation
5. ESD estimation
Windowing
0 10 20 30 40 50 60 700
0.5
1
n
f[n]
0 5 10 15 20 25 30 350
1
2
3
omega
mag
nitu
de