3. 10.2 - Discrete Fourier Transform (DFT)
• A finite or periodic sequence has only N unique values,
f d h l l
x[n] for 0 ≤ n p N
• S t
Spectrum is completely defined by N distinct frequency
i l t l d fi d b di ti t f
samples
• Divide 0..2π into N equal steps {ω(k)} = 2πk/N
0 2π steps,
• Uniform sampling of DTFT spectrum:
4. 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
5. 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 k 1,
k=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 ⎠
6. 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}
7. 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) ={ , 0, 0,1
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}
9. 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 1) complex additions
N(N-1)
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 for efficient
t iti f ffi i t
algorithm to be used to reduce
the DFT complexity
10. 10.5 – Fast Fourier Transform (FFT)
• Reduce complexity of DFT from O(N2) to O(N log2N)
O(N·log
• Grows more slowly with larger N
• Works by decomposing large DFT into several stages of
smaller DFTs
• Often provided as a highly optimized library
11. 10.6 - Decimation in Time (DIT) FFT
• Can rearrange DFT formula in 2 halves:
12. 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
14. 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 ?
• ie
i.e.
• so have
• Similarly,
19. 10.9 - FFT Complexity
N
• Total no. of butterflies =
Total no. of butterflies log 2 N
g
2 No of stages
f t
• As each butterfly gives one complex multiplication and 2
As 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
Ο(Nl 2 N) i
(Nlog instead of Ο(N(N - 1)) i case of DFT
d f in f
20. 10.10 - Inverse FFT
•
• Thus
Steps f calculating IFFT:
St for l l ti 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.
4 Take the conjugate of the output