CE 40763 Digital Signal Processing Fall 1992 Fast Fourier transform (FFT)
description
Transcript of CE 40763 Digital Signal Processing Fall 1992 Fast Fourier transform (FFT)
![Page 1: CE 40763 Digital Signal Processing Fall 1992 Fast Fourier transform (FFT)](https://reader035.fdocuments.net/reader035/viewer/2022062501/568161b3550346895dd17ab2/html5/thumbnails/1.jpg)
CE 40763Digital Signal Processing
Fall 1992
Fast Fourier transform (FFT)Hossein Sameti
Department of Computer Engineering Sharif University of Technology
![Page 2: CE 40763 Digital Signal Processing Fall 1992 Fast Fourier transform (FFT)](https://reader035.fdocuments.net/reader035/viewer/2022062501/568161b3550346895dd17ab2/html5/thumbnails/2.jpg)
Many real-life systems can be modeled by LTI systems use convolution for computing the output use DFT to compute convolution
Fast Fourier Transform (FFT) is a method for calculating Discrete Fourier Transform (DFT) Only faster!
Definition of DFT: How many computations?
Motivation
2
otherwise
NkenxkXN
n
Nknj
0
0)()(1
0
2
N pt. DFT of x(n)Q: For each k: How many adds and how many mults?
A: (N-1) complex adds and N complex mults.
How many k values do we have? N22 2)1(. NNNNComputNum )( 2NO
Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
![Page 3: CE 40763 Digital Signal Processing Fall 1992 Fast Fourier transform (FFT)](https://reader035.fdocuments.net/reader035/viewer/2022062501/568161b3550346895dd17ab2/html5/thumbnails/3.jpg)
Motivation
3
otherwise
NkenxkXN
n
Nknj
0
0)()(1
0
2
)( 2NODirect computation:
FFT: )log( 2NNO
Ideal case: .)(ConstO
N Direct FFT
10^3 O(10^6) O(10^3*log10^3)=O(10^4)
10^6 O(10^12) O(10^6*log10^6)=O(2*10^7)
Example:
Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
![Page 4: CE 40763 Digital Signal Processing Fall 1992 Fast Fourier transform (FFT)](https://reader035.fdocuments.net/reader035/viewer/2022062501/568161b3550346895dd17ab2/html5/thumbnails/4.jpg)
4
Algorithms for calculating FFT
FFT
Decimation in time
Decimation in frequency
Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
![Page 5: CE 40763 Digital Signal Processing Fall 1992 Fast Fourier transform (FFT)](https://reader035.fdocuments.net/reader035/viewer/2022062501/568161b3550346895dd17ab2/html5/thumbnails/5.jpg)
Decimation in time
5
otherwise
NkenxkXN
n
Nknj
0
0)()(1
0
2
• The main idea: use the divide and conquer method
• It works by recursively breaking down a problem into two or more sub-problems of the same (or related) type, until these become simple enough to be solved directly.
• The solutions to the sub-problems are then combined to give a solution to the original problem.
Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
![Page 6: CE 40763 Digital Signal Processing Fall 1992 Fast Fourier transform (FFT)](https://reader035.fdocuments.net/reader035/viewer/2022062501/568161b3550346895dd17ab2/html5/thumbnails/6.jpg)
Decimation in time
6
otherwise
NkenxkXN
n
Nknj
0
0)()(1
0
2
1
0
21
0
2
)()()(N
n
NknjN
n
Nknj
enxenxkX
N: power of 2
n: even n: oddn: even n=2r r:0N/2-1n:0N-2
n: odd n=2r+1 r:0N/2-1n:1N-1
1
2
0
)12(212
0
)2(2
)12()2()(N
r
Nrkj
N
r
Nrkj
erxerxkX
Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
![Page 7: CE 40763 Digital Signal Processing Fall 1992 Fast Fourier transform (FFT)](https://reader035.fdocuments.net/reader035/viewer/2022062501/568161b3550346895dd17ab2/html5/thumbnails/7.jpg)
7
Decimation in time
1
2
0
)12(212
0
)2(2
)()()(N
r
Nrkj
N
r
Nrkj
erhergkX
1
2
0
)12(212
0
)2(2
)12()2()(N
r
Nrkj
N
r
Nrkj
erxerxkX
12
02/
2212
02/
2
)()()(
N
rN
krjN
kjN
rN
krjerheergkX
12
0
2/2
)()(N
r
Nkrj
ergkG
12
02/
2
)()(
N
rN
krjerhkH
Suppose:
)()()(2
kHekGkX Nkj
• What are G(k) and H(k)?
![Page 8: CE 40763 Digital Signal Processing Fall 1992 Fast Fourier transform (FFT)](https://reader035.fdocuments.net/reader035/viewer/2022062501/568161b3550346895dd17ab2/html5/thumbnails/8.jpg)
8
Decimation in time
12
0
2/2
)()(N
r
Nkrj
ergkG
12
0
2/2
)()(N
r
Nkj
erhkH
)()()(2
kHekGkX Nkj
• In G(k) and H(k), k varies between 0 and N/2-1.• However, in X(k) , k varies between 0 and N-1.
Solution: use the relationship between DFS and DFT.
We thus need to replicate G(k) and H(k) “once”, to get X(k).
Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
![Page 9: CE 40763 Digital Signal Processing Fall 1992 Fast Fourier transform (FFT)](https://reader035.fdocuments.net/reader035/viewer/2022062501/568161b3550346895dd17ab2/html5/thumbnails/9.jpg)
9
Decimation in time
)(nx
g(r)
h(r)
2N
2N
pt. DFT2N
pt. DFT2N
)(kG
)(kH
Nkj
e2
+
)(kX
kNW
(twiddle factor)
After replication
Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
![Page 10: CE 40763 Digital Signal Processing Fall 1992 Fast Fourier transform (FFT)](https://reader035.fdocuments.net/reader035/viewer/2022062501/568161b3550346895dd17ab2/html5/thumbnails/10.jpg)
10
Decimation in time
)(nx
g(r)
h(r)
pt. DFT2N
pt. DFT2N
12
0 N
12
0 N
12
NN
12
NN
)0(G
)0(H
)0()2
( GNG
)0()2
( HNH
)0()0()0( 0 HWGX N
)0()0()2
( 2/ HWGNX NN
)()()(2
kHekGkX Nkj
Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
![Page 11: CE 40763 Digital Signal Processing Fall 1992 Fast Fourier transform (FFT)](https://reader035.fdocuments.net/reader035/viewer/2022062501/568161b3550346895dd17ab2/html5/thumbnails/11.jpg)
11
Example of Decimation in time (N=8))()()( kHWkGkX k
N
Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
![Page 12: CE 40763 Digital Signal Processing Fall 1992 Fast Fourier transform (FFT)](https://reader035.fdocuments.net/reader035/viewer/2022062501/568161b3550346895dd17ab2/html5/thumbnails/12.jpg)
12
Example of Decimation in time (N=8)
N/2 pt. DFT block
Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
![Page 13: CE 40763 Digital Signal Processing Fall 1992 Fast Fourier transform (FFT)](https://reader035.fdocuments.net/reader035/viewer/2022062501/568161b3550346895dd17ab2/html5/thumbnails/13.jpg)
13
Example of Decimation in time (N=8)
Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
![Page 14: CE 40763 Digital Signal Processing Fall 1992 Fast Fourier transform (FFT)](https://reader035.fdocuments.net/reader035/viewer/2022062501/568161b3550346895dd17ab2/html5/thumbnails/14.jpg)
14
Example of Decimation in time (N=8)
1
0
2
)()(N
n
Nknj
enrkR
2N2
)1(22
)0(2
)1()0()(kjkj
ererkR
kjerrkR )1()0()(
r(0)
r(1)
Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
![Page 15: CE 40763 Digital Signal Processing Fall 1992 Fast Fourier transform (FFT)](https://reader035.fdocuments.net/reader035/viewer/2022062501/568161b3550346895dd17ab2/html5/thumbnails/15.jpg)
15
Example of Decimation in time (N=8)
kjerrkR )1()0()(
0k )1()0()0( rrR
1k )1()0()1( rrR
r(0)
r(1)
)4()0()0( xxR
)4()0()1( xxR
Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
![Page 16: CE 40763 Digital Signal Processing Fall 1992 Fast Fourier transform (FFT)](https://reader035.fdocuments.net/reader035/viewer/2022062501/568161b3550346895dd17ab2/html5/thumbnails/16.jpg)
16
Example of Decimation in time (N=8)
Flow graph of a the 2-pt. DFT
Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
![Page 17: CE 40763 Digital Signal Processing Fall 1992 Fast Fourier transform (FFT)](https://reader035.fdocuments.net/reader035/viewer/2022062501/568161b3550346895dd17ab2/html5/thumbnails/17.jpg)
17
Example of Decimation in time (N=8)
How many stages do we have? N2log
Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
![Page 18: CE 40763 Digital Signal Processing Fall 1992 Fast Fourier transform (FFT)](https://reader035.fdocuments.net/reader035/viewer/2022062501/568161b3550346895dd17ab2/html5/thumbnails/18.jpg)
General form of a butterfly
18
)2
(22
NrN
jNr
N eW
)2
(22
.N
Njr
Nj
ee
rN
je
2
rNW
Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
![Page 19: CE 40763 Digital Signal Processing Fall 1992 Fast Fourier transform (FFT)](https://reader035.fdocuments.net/reader035/viewer/2022062501/568161b3550346895dd17ab2/html5/thumbnails/19.jpg)
19
Revised form of a butterfly
2Nr
NW r
NW
Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
![Page 20: CE 40763 Digital Signal Processing Fall 1992 Fast Fourier transform (FFT)](https://reader035.fdocuments.net/reader035/viewer/2022062501/568161b3550346895dd17ab2/html5/thumbnails/20.jpg)
20
Revised form of a butterfly
2 mults+ 2 adds
1 mult+ 2 adds
Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
![Page 21: CE 40763 Digital Signal Processing Fall 1992 Fast Fourier transform (FFT)](https://reader035.fdocuments.net/reader035/viewer/2022062501/568161b3550346895dd17ab2/html5/thumbnails/21.jpg)
Final figure for 8-pt DFT
21
In-place computation (only N storage locations are needed)Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
![Page 22: CE 40763 Digital Signal Processing Fall 1992 Fast Fourier transform (FFT)](https://reader035.fdocuments.net/reader035/viewer/2022062501/568161b3550346895dd17ab2/html5/thumbnails/22.jpg)
Computational complexity
22
• How many stages do we have N2log
• Each stage has N inputs and N outputs.
• Each butterfly has 2 inputs and 2 outputs.
• Each stage has butterflies.2N
• Each butterfly needs 1 mult and 2 adds.
Total number of operations: NNN N loglog2
2 2 adds
NNN N log2
log2 2 mults
Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
![Page 23: CE 40763 Digital Signal Processing Fall 1992 Fast Fourier transform (FFT)](https://reader035.fdocuments.net/reader035/viewer/2022062501/568161b3550346895dd17ab2/html5/thumbnails/23.jpg)
Indexing of the inputs and outputs
23
Output indexing is in order.
input indexing is shuffled.
Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
![Page 24: CE 40763 Digital Signal Processing Fall 1992 Fast Fourier transform (FFT)](https://reader035.fdocuments.net/reader035/viewer/2022062501/568161b3550346895dd17ab2/html5/thumbnails/24.jpg)
Bit reversing
24
)0(X ]000[0
)1(X ]100[1
)2(X ]010[2
)3(X ]110[3
)4(X 4
)5(X 5
)6(X 6
)7(X 7
]001[
]101[
]011[
]111[
]100[
]000[
]001[
]010[
]011[
]100[
]101[
]110[
]111[
]001[
0
4
2
6
1
5
3
7
Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
![Page 25: CE 40763 Digital Signal Processing Fall 1992 Fast Fourier transform (FFT)](https://reader035.fdocuments.net/reader035/viewer/2022062501/568161b3550346895dd17ab2/html5/thumbnails/25.jpg)
Re-arranging the input order
25Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
![Page 26: CE 40763 Digital Signal Processing Fall 1992 Fast Fourier transform (FFT)](https://reader035.fdocuments.net/reader035/viewer/2022062501/568161b3550346895dd17ab2/html5/thumbnails/26.jpg)
Re-arranging the input order
26Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
![Page 27: CE 40763 Digital Signal Processing Fall 1992 Fast Fourier transform (FFT)](https://reader035.fdocuments.net/reader035/viewer/2022062501/568161b3550346895dd17ab2/html5/thumbnails/27.jpg)
Decimation in frequency
27
otherwise
NkenxkXN
n
Nknj
0
0)()(1
0
2
• The main idea: use the divide and conquer method (this time in the frequency domain)
• Divide the computation into two parts: even indices of k and odd indices of k.
Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
![Page 28: CE 40763 Digital Signal Processing Fall 1992 Fast Fourier transform (FFT)](https://reader035.fdocuments.net/reader035/viewer/2022062501/568161b3550346895dd17ab2/html5/thumbnails/28.jpg)
28
Decimation in frequency
otherwise
NkenxkXN
n
Nknj
0
0)()(1
0
2
rk 2
1
0
2/)(2
20)()2(
N
n
Nnrj NrenxrX
1
2
2/)(21
2
0
2/)(2
)()()2(N
Nn
Nnrj
N
n
Nnrj
enxenxrX
2Nmn
1
2
0
2/
)2
)((212
0
2/)(2
)2
()()2(N
m
N
Nmrj
N
n
Nnrj
eNmxenxrX
1
Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
![Page 29: CE 40763 Digital Signal Processing Fall 1992 Fast Fourier transform (FFT)](https://reader035.fdocuments.net/reader035/viewer/2022062501/568161b3550346895dd17ab2/html5/thumbnails/29.jpg)
29
Decimation in frequency
1
2
0
2/)(21
2
0
2/)(2
)2
()()2(N
m
Nmrj
N
n
Nnrj
eNmxenxrX
1
2
0
2/)(21
2
0
2/)(2
)2
()()2(N
n
Nnrj
N
n
Nnrj
eNnxenxrX
1
2
0
2/)(2
))2
()(()2(N
n
Nnrj
eNnxnxrX
)(ng
N/2 pt. DFT of g(n)
20 Nr
Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
![Page 30: CE 40763 Digital Signal Processing Fall 1992 Fast Fourier transform (FFT)](https://reader035.fdocuments.net/reader035/viewer/2022062501/568161b3550346895dd17ab2/html5/thumbnails/30.jpg)
30
Decimation in frequency
1
2
0
2/)(2
))2
()(()2(N
n
Nnrj
eNnxnxrX
Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
![Page 31: CE 40763 Digital Signal Processing Fall 1992 Fast Fourier transform (FFT)](https://reader035.fdocuments.net/reader035/viewer/2022062501/568161b3550346895dd17ab2/html5/thumbnails/31.jpg)
31
Decimation in frequency
12 rk
1
0
)12(2
20)()12(
N
n
Nnrj NrenxrX
1
2
)12(212
0
)12(2
)()()12(N
Nn
Nnrj
N
n
Nnrj
enxenxrX
2Nmn
12
0
)2
)(12(212
0
)12(2
)2
()()12(N
m
N
Nmrj
N
n
Nnrj
eNmxenxrX
Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
![Page 32: CE 40763 Digital Signal Processing Fall 1992 Fast Fourier transform (FFT)](https://reader035.fdocuments.net/reader035/viewer/2022062501/568161b3550346895dd17ab2/html5/thumbnails/32.jpg)
32
Decimation in frequency
12
0
)2
)(12(212
0
)12(2
)2
()()12(N
m
N
Nmrj
N
n
Nnrj
eNmxenxrX
12
0
))(12(2)12(2
212
0
)12(2
)2
()()12(N
m
Nmrj
N
rN
jN
n
Nnrj
eNmxeenxrX
-1
12
0
))(12(212
0
)12(2
)2
()()12(N
n
Nnrj
N
n
Nnrj
eNnxenxrX
Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
![Page 33: CE 40763 Digital Signal Processing Fall 1992 Fast Fourier transform (FFT)](https://reader035.fdocuments.net/reader035/viewer/2022062501/568161b3550346895dd17ab2/html5/thumbnails/33.jpg)
33
Decimation in frequency
12
0
))(12(212
0
)12(2
)2
()()12(N
n
Nnrj
N
n
Nnrj
eNnxenxrX
12
0
)12(2
))2
()(()12(N
n
Nnrj
eNnxnxrX
1
2
0
2/)(22
]))2
()([()12(N
n
Nnrj
Nnj
eeN
nxnxrX
)(nh
N/2 pt. DFT of h(n) Nnj
e2
Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
![Page 34: CE 40763 Digital Signal Processing Fall 1992 Fast Fourier transform (FFT)](https://reader035.fdocuments.net/reader035/viewer/2022062501/568161b3550346895dd17ab2/html5/thumbnails/34.jpg)
34
Decimation in frequency
1
2
0
2/)(22
]))2
()([()12(N
n
Nnrj
Nnj
eeNnxnxrX
Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
![Page 35: CE 40763 Digital Signal Processing Fall 1992 Fast Fourier transform (FFT)](https://reader035.fdocuments.net/reader035/viewer/2022062501/568161b3550346895dd17ab2/html5/thumbnails/35.jpg)
35
Decimation in frequency
![Page 36: CE 40763 Digital Signal Processing Fall 1992 Fast Fourier transform (FFT)](https://reader035.fdocuments.net/reader035/viewer/2022062501/568161b3550346895dd17ab2/html5/thumbnails/36.jpg)
Format of the Last stage Butterfly in Decimation in frequency
36Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
![Page 37: CE 40763 Digital Signal Processing Fall 1992 Fast Fourier transform (FFT)](https://reader035.fdocuments.net/reader035/viewer/2022062501/568161b3550346895dd17ab2/html5/thumbnails/37.jpg)
37
Decimation in frequency
Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
![Page 38: CE 40763 Digital Signal Processing Fall 1992 Fast Fourier transform (FFT)](https://reader035.fdocuments.net/reader035/viewer/2022062501/568161b3550346895dd17ab2/html5/thumbnails/38.jpg)
38
Decimation in frequency (re-order the output)
Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
![Page 39: CE 40763 Digital Signal Processing Fall 1992 Fast Fourier transform (FFT)](https://reader035.fdocuments.net/reader035/viewer/2022062501/568161b3550346895dd17ab2/html5/thumbnails/39.jpg)
39
Decimation in frequency (ordered input and output)
Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
![Page 40: CE 40763 Digital Signal Processing Fall 1992 Fast Fourier transform (FFT)](https://reader035.fdocuments.net/reader035/viewer/2022062501/568161b3550346895dd17ab2/html5/thumbnails/40.jpg)
Change x with X (i.e., input nodes with output nodes) Change X with x (i.e., output nodes with input nodes) Reverse the order of the flow graphs. The same system function is achieved.
40
Transposition theorem
Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
![Page 41: CE 40763 Digital Signal Processing Fall 1992 Fast Fourier transform (FFT)](https://reader035.fdocuments.net/reader035/viewer/2022062501/568161b3550346895dd17ab2/html5/thumbnails/41.jpg)
41
Decimation in frequency
Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
![Page 42: CE 40763 Digital Signal Processing Fall 1992 Fast Fourier transform (FFT)](https://reader035.fdocuments.net/reader035/viewer/2022062501/568161b3550346895dd17ab2/html5/thumbnails/42.jpg)
Transposed version of the previous figure (Decimation in Time)
42Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
![Page 43: CE 40763 Digital Signal Processing Fall 1992 Fast Fourier transform (FFT)](https://reader035.fdocuments.net/reader035/viewer/2022062501/568161b3550346895dd17ab2/html5/thumbnails/43.jpg)
How can we deal with twiddle factors? Should we store them in a table (i.e, use a
lookup table) or should we calculate them? What happens if N is not a factor of 2? It can be shown that if N=RQ, then an N pt.
DFT can be expressed in terms of R Q-pt. DFT or Q R pt. DFTs (Cooley-Tukey algorithm).
Practical issues
43Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology