You are on page 1of 20

EC533: Digital Signal Processing

5 l l

Lecture 10
DFT and FFT
10.1 - Frequency Domain Vs. Time Domain

CTFS DTFS

CTFT DTFT
10.2 - Discrete Fourier Transform (DFT)

• A finite
f or periodic
d sequence hash only l N unique values,
l
x[n] for 0 ≤ n p N
• Spectrum
S t is
i completely
l t l defined
d fi d by
b N distinct
di ti t frequency
f
samples
• Divide 0..2π
0 2π into N equal steps
steps, {ω(k)} = 2πk/N
• Uniform sampling of DTFT spectrum:
10.2 – DFT – contd.
Hence,

Where, i.e, 1/Nth of a revolution

Twiddle Factor

Properties of the Twiddle Factor:


k+N k j
W N
=
W N
periodicity
N
k+ k
W N
2 = −
W N
-1
1
2
W N
=
W N
2
-j
N=4
DFT Example
Find the DFT for the 4 points time sequence {1 0 0 1}, fs=8KHz
3 3
X (0) = ∑ x(nT ) e − j 0 = ∑ x(nT )
¾ at k=0,

n =0 n =0

= x(0) + x(T ) + x(2T ) + x(3T )


= 1+ 0 + 0 +1 = 2
3
¾ at kk=1,
1, X (1) = ∑ x(nT ) e − jΩnT , Ω = 2π
n =0
NT
3
− j 2πn
X (1) = ∑ x(nT ) e N

n =0
= 1 + 0 + 0 + 1e − j 2π 3 4 = 1 + e − j 3π 4

⎛ 3π ⎞ ⎛ 3π ⎞
= 1 + cos⎜ ⎟ − j sin ⎜ ⎟ = 1+ j
⎝ 2 ⎠ ⎝ 2 ⎠
DFT Example – contd.
3 3
− j 2π 2 n
¾ at k=2, X (2) = ∑ x(nT ) e − j 2 ΩnT
= ∑ x(nT ) e N

n =0 n =0
3
− j 4πn
= ∑ x(nT ) e N

n =0

= 1 + 0 + 0 + 1e − j 4π 3 4 = 1 + e − j 3π = 1 − 1 = 0
3
− j 2π 3 n
¾ at k=3, X (3) = ∑ x(nT ) e N

n =0

= 1 + 0 + 0 + 1e − j 9π 2 = 1 − j

X (k ) = {2, 1 + j , 0, 1 − j}
DFT Example – contd.
x(nT) |X(k)|
1 2
√2

x x x
0 125 250 375 t(µs) 0 12.57 25.14 37.71 50.28
kΩ(X 103 rad/s)
φ(k)(⁰)
x(n) ={1, 0, 0,1} +45 Phase Angle 
indeterminate
37.71
0 x x
12.57 25.14 50.28
kΩ(X 103 rad/s)

‐45

X(k) ={2,1+ j, 0,1− j}


10.3 - Inverse Discrete Fourier Transform
(
(IDFT))

• Check
Ch k
10.4 - DFT Computational Complexity
The DFT
has:
• (N complex multiplies + N-1 complex adds per point) x N points (k = 0..N-1)
N2 complex multiplies and N(N
N(N-1)
1) complex additions
where
cpx mult: (a+jb)(c+jd) = ac - bd + j(ad+bc)= 4 real mults + 2 real adds

cpx add = 2 real adds

• Total: 4N2 real mults, 4N2-2N real adds

•Looking at DFT Matrix,


lots of repeated structure are found;
means opportunities
t iti for
f efficient
ffi i t
algorithm to be used to reduce
the DFT complexity
10.5 – Fast Fourier Transform (FFT)

• Reduce complexity of DFT from O(N2) to O(N


O(N·log
log2N)

• Grows more slowly with larger N

• Works by decomposing large DFT into several stages of


smaller DFTs

• Often provided as a highly optimized library


10.6 - Decimation in Time (DIT) FFT

• Can rearrange DFT formula in 2 halves:


10.6 - Decimation in Time (DIT) FFT - contd.

• We can evaluate an N-pt DFT as two N/2-pt DFTs


(plus a few mults/adds)

• But if DFTN{•} ~ O(N2)


then DFTN/2{•} ~ O((N/2)2) = 1/4 O(N2)

• Total computation ~ 2 * 1/4 O(N2)


= 1/2 the computation (+ε) of direct DFT
10.6.1 - One-Stage DIT Flowgraph
10.6.2 - Multiple DIT Stages
• If decomposing one DFTN into two smaller DFTN/2’s speeds things
up...
p
• Why not further divide into DFTN/4’s ?

• i.e.
ie

• so have

• Similarly,
10.6.2 - Multiple DIT Stages – contd.
Two-Stage DIT Flowgraph
10.6.2 - Multi-stage DIT FFT – contd.

• Can keep doing this until we get down to 2-pt DFTs:

x(0)
x(1)
10.7 - FFT Implementation Details
• Basic Butterfly at any stage

• Can be simplified to
10. 8 - 8-pt DIT FFT Flowgraph

000
001
010
0 0
2
011 W
8
100
101
110
111 2
W
8

• -1’s absorbed into summation nodes

• WN0 disappears

• Twiddle factor step=N/2 j (stage order), j≠1


10.9 - FFT Complexity

N
• Total no. of butterflies 
Total no. of butterflies =  logg 2 N
2 No off stages
t

• As
As each butterfly gives one complex multiplication and 2 
each butterfly gives one complex multiplication and 2
complex addition
• So, FFT has complex multiplications of 
So, FFT has complex multiplications of
N
Ο( log 2 N) instead of Ο(N 2 ) in case of DFT
2

and complex additions  of
Ο(Nlog d off Ο(N(N - 1)) in
(Nl 2 N) instead
i i case off DFT
10.10 - Inverse FFT

• Thus

St
Steps ffor calculating
l l ti IFFT:
IFFT
1. Take the conjugate of the freq.
•Hence, Use FFT to calculate IFFT Samples
2. Calculate FFT of these samples
3. Divide the output by N
4 Take the conjugate of the output
4.

You might also like