1
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
1
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
Digital Signal Processing:6. The Fast Fourier Transform (FFT)
Recall the DFT equation again,
for k = 0, 1,…, N-1
If N = 8, we have
for k = 0, 1,…,7
1N
0n
nkW)n(x)k(X
18
0n
nkW)n(x)k(X
k3k2k0 W)3(xW)2(xW)1(xW)0(x
k7k6k5k4 W)7(xW)6(xW)5(xW)4(x
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
2
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
or00000000 W)7(xW)6(xW)5(xW)4(xW)3(xW)2(xW)1(xW)0(x)0(X
76543210 W)7(xW)6(xW)5(xW)4(xW)3(xW)2(xW)1(xW)0(x)1(X
14121086420 W)7(xW)6(xW)5(xW)4(xW)3(xW)2(xW)1(xW)0(x)2(X
211815129630 W)7(xW)6(xW)5(xW)4(xW)3(xW)2(xW)1(xW)0(x)3(X
2824201612840 W)7(xW)6(xW)5(xW)4(xW)3(xW)2(xW)1(xW)0(x)4(X
35302520151050 W)7(xW)6(xW)5(xW)4(xW)3(xW)2(xW)1(xW)0(x)5(X
42363024181260 W)7(xW)6(xW)5(xW)4(xW)3(xW)2(xW)1(xW)0(x)6(X
49423528211470 W)7(xW)6(xW)5(xW)4(xW)3(xW)2(xW)1(xW)0(x)7(X
2
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
3
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
In matrix form
Hence there are a lot of duplicated calculations,great simplification is possible.
)7(x
)6(x
)5(x
)4(x
)3(x
)2(x
)1(x
)0(x
WWWWWWWW
WWWWWWWW
WWWWWWWW
WWWWWWWW
WWWWWWWW
WWWWWWWW
WWWWWWWW
WWWWWWWW
)7(X
)6(X
)5(X
)4(X
)3(X
)2(X
)1(X
)0(X
12345670
24602460
36147250
40404040
52741630
64206420
76543210
00000000
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
4
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
Note that
1. the number of operations required for the computation of a DFT of a sequence with N elements,
Multiplications: M = N2, the order of N2
Additions: A = N(N-1), also the order of N2
and
2. the Circulant Property of the DFT is important.
X(rN+k) = X(k)
N 2N-N 0t
• • •• • •
X(k)
3
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
5
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
The Fast Fourier TransformDecimation-in-Time Decomposition:
Recall the DFT of N-point
where
Define
x1(n) = x(2n)
x2(n) = x(2n+1)
for
where
the length of x1(n) and x2(n) is N1
1N
0n
nkW)n(x)k(X
N
2jN eW,1W
r2N
)1N(,,1,0n 1
2N
1N
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
6
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
Define the DFT of {x1(n)} and {x2(n)}
where
1N
0n
nk111
1
W)n(x)k(X
1N
0n
nk122
1
W)n(x)k(X
2N
2j
1 WeW 1
4
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
7
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
Since
and
for any integer r.
i.e. X1(k) and X2(k) are periodic function of
for finding
we only need to find
)rNk(X)k(X 122
2
NN1
)1N(X,,)1(X),0(X 111
1)2
N(X,(1),X(0),X 111
)rNk(X)k(X 111
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
8
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
Now
= x(0)W0 + x(2)W2k + x(4)W4k + …+ x(N-2)W(N-2)k
+ x(1)Wk + x(3)W3k + x(5)W5k + …+ x(N-1)W(N-1)k
1N
0n
nkW)n(x)k(X
5
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
9
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
Now
= x(0)W0 + x(2)W2k + x(4)W4k + …+ x(N-2)W(N-2)k
+ x(1)Wk + x(3)W3k + x(5)W5k + …+ x(N-1)W(N-1)k
[x(1)W0 + x(3)W2k + x(5)W4k + …+ x(N-1)W(N-2)k]Wk
1N
0n
nkW)n(x)k(X
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
10
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
Now
= x(0)W0 + x(2)W2k + x(4)W4k + …+ x(N-2)W(N-2)k
+ x(1)Wk + x(3)W3k + x(5)W5k + …+ x(N-1)W(N-1)k
[x(1)W0 + x(3)W2k + x(5)W4k + …+ x(N-1)W(N-2)k]Wk
for k = 0,1,2, …, N-1
1N
0n
nkW)n(x)k(X
k21 (k)WX(k)XX(k)
6
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
11
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
)7(x
)5(x
)3(x
)1(x
WWWW
WWWW
WWWW
WWWW
W000
0W00
00W0
000W
)6(x
)4(x
)2(x
)0(x
WWWW
WWWW
WWWW
WWWW
)3(X
)2(X
)1(X
)0(X
91
61
31
01
61
41
21
01
31
21
11
01
01
01
01
01
3
2
1
0
91
61
31
01
61
41
21
01
31
21
11
01
01
01
01
01
Note the equation for k = 0,1,2, …, N-1
can be written as
)7(x
)5(x
)3(x
)1(x
WWWW
WWWW
WWWW
WWWW
W000
0W00
00W0
000W
)6(x
)4(x
)2(x
)0(x
WWWW
WWWW
WWWW
WWWW
)7(X
)6(X
)5(X
)4(X
91
61
31
01
61
41
21
01
31
21
11
01
01
01
01
01
7
6
5
4
91
61
31
01
61
41
21
01
31
21
11
01
01
01
01
01
k21 (k)WX(k)XX(k)
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
12
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
Note very carefully that we have converted an N-length DFT into two length-½N DFT with some additional operations.
That is N-length DFT 2 length-½N DFTs
+ N complex multiplications+ N complex additions
Let us check the number of multiplications at this stage, say for example:
complex multiplications for X1(k)
complex multiplications for X2(k)
N complex multiplications for WkX2(k)
The total number of complex multiplications is
2
2
N
2
2
N
2
NNN
2
N
2
N 222
N
2
11N
7
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
13
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
An example
N = 8 = 23
X(k) = x(0) + x(2)W2k + x(4)W4k + x(6)W6k
+ [x(1) + x(3)W2k + x(5)W4k + x(7)W6k ] Wk
where k = 0, 1,…,7
X(k) = X1(k) + X2(k)Wk
where X1(k) = x(0) + x(2)W2k + x(4)W4k + x(6)W6k
X2(k) = x(1) + x(3)W2k + x(5)W4k + x(7)W6k
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
14
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
Wm will repeat itself at a distance of m = 8
W2m will repeat itself at a distance of m = 4
since W1 = W 2
we have,
X1(k) = X1(k + 4)
X2(k) = X2(k + 4)
8
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
15
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
For X1(k) = x(0) + x(2)W2k + x(4)W4k + x(6)W6k
where k = 0, 1,…,7
X1(0) = x(0)W0 + x(2)W0 + x(4)W0 + x(6)W0
X1(1) = x(0)W0 + x(2)W2 + x(4)W4 + x(6)W6
X1(2) = x(0)W0 + x(2)W4 + x(4)W8 + x(6)W12
X1(3) = x(0)W0 + x(2)W6 + x(4)W12 + x(6)W18
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
16
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
X1(4) = x(0)W0 + x(2)W8 + x(4)W16 + x(6)W24
= x(0)W0 + x(2)W0 + x(4)W0 + x(6)W0 = X1(0)
X1(5) = x(0)W0 + x(2)W10 + x(4)W20 + x(6)W30
= x(0)W0 + x(2)W2 + x(4)W4 + x(6)W6 = X1(1)
Similarly
X1(6) = X1(2)
X1(7) = X1(3)
9
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
17
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
We just have to compute
X1(k), for k = 0, 1, 2, 3
i.e
for k = 0, 1, 2, 3
nk111 W)n(x)k(X
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
18
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
=1= X1(k)
X1(k+4) = X1(k)
only X1(k) for need to be computed.
1N
0n
)4k(n111
1
W)n(x)4k(X,Or
1N
0n
n41
nk11
1
WW)n(x
2
N,,1,0k
10
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
19
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
for k = 0, 1, 2, 3
Similarly we may decompose {x(0), x(2), x(4), x(6)}
into two sets:
{x(0), x(4)} and {x(2), x(6)}
2 length-2 sequences
k6k4k21 W)6(xW)4(xW)2(x)0(x)k(X
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
20
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
Again define
where W2 = W12= W4
for k = 0, 1, 2, 3
We have
X11(0) = x(0) + x(4)W0
X11(1) = x(0) + x(4)W4
X11(2) = x(0) + x(4)W8 = X11(0)
X11(3) = x(0) + x(4)W12 = X11(1)
we only have to find X11(k) for k = 0, 1
k4k211 W)4(x)0(xW)4(x)0(x)k(X
11
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
21
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
Similarly,
for k = 0, 1
Also
k212 W)6(x)2(x)k(X
k212111 W)k(X)k(X)k(X
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
22
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
Similarly
for k = 0, 1
for k = 0, 1, 2, 3
k421 W)5(x)1(x)k(X
k422 W)7(x)3(x)k(X
k222212 W)k(X)k(X)k(X
12
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
23
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
the splitting of N is shown below
24
28
24
2
• For each stage we need to compute N numbers
• Each operation is computed from 2 numbers obtained in the previous stage
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
24
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
Sub-Summary:
(i) for the 1st stage
X(k) = X1(k) +Wk X2(k)
for k = 0, 1,…,7
For each k, we need one complex multiplication
N complex multiplications
13
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
25
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
(ii) for the 2nd stage
complex multiplications
complex multiplications
for k = 0, 1, 2, 3
)k(XW)k(X)k(X 12k2
111
2
N
)k(XW)k(X)k(X 22k2
212
2
N
N complex multiplications
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
26
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
(iii) for the 3rd stage
for k = 0, 1
W n Twiddle Factor
8 complex multiplications
k411 W)4(x)0(x)k(X
k412 W)6(x)2(x)k(X
k421 W)5(x)1(x)k(X
k422 W)7(x)3(x)k(X
14
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
27
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
Hence, the total number of complex multiplications for the whole process is
M = N log2 N
For the present example
M = 8 log2 8 = 24
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
28
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
Equations:(Decimation in Time Decomposition)
3rd stage X11(0) = x(0) + x(4)W0 X21(0) = x(1) + x(5)W0
X11(1) = x(0) + x(4)W4 X21(1) = x(1) + x(5)W4
X12(0) = x(2) + x(6)W0 X22(0) = x(3) + x(7)W0
X12(1) = x(2) + x(6)W4 X22(1) = x(3) + x(7)W4
2nd stage X1(0) = X11(0) + X12(0)W0 X2(0) = X21(0) + X22(0)W0
X1(1) = X11(1) + X12(1)W2 X2(1) = X21(1) + X22(1)W2
X1(2) = X11(0) + X12(1)W4 X2(2) = X21(0) + X22(0)W4
X1(3) = X11(1) + X12(1)W6 X2(3) = X21(1) + X22(1)W6
1st stage X(0) = X1(0) + X2(0)W0 X(4) = X1(0) + X2(0)W4
X(1) = X1(1) + X2(1)W1 X(5) = X1(1) + X2(1)W5
X(2) = X1(2) + X2(2)W2 X(6) = X1(2) + X2(2)W6
X(3) = X1(3) + X2(3)W3 X(7) = X1(3) + X2(3)W7
Equations
15
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
29
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
Decimation-in-time decomposition of an eight-pointDFT computation
x(0)
x(1)
x(2)
x(3)
x(4)
x(5)
x(6)
x(7)
X11(0)
X21(0)
X12(0)
X22(0)
X11(1)
X21(1)
X12(1)
X22(1)
W4
W4
W4
W4
X1(0)
X2(0)
X1(2)
X2(2)
X1(1)
X2(1)
X1(3)
X2(3)
W4
W4
W2
W6
W2
W6
X(0)
X(4)
X(2)
X(6)
W4
W6
W2
X(1)W
1
W5
W3
W7
X(5)
X(3)
X(7)
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
30
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
W3
W7
W2
W6
W0
W4
Decimation-in-time decomposition of an eight-point
DFT computation
16
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
31
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
Flow graph of basic butterfly computation (DIT)
A
B
A’
B’
Wr
2
Nr
W
BWA'B 2
Nr
BWA'A r
BWA r
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
32
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
Flow graph of simplified butterfly computation
requiring only one complex multiplication
-1
A
B
A’
B’Wr
17
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
33
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
This suggests a means of reducing the number of complex multiplications by a factor of 2
the whole FFT process requires only approximately
complex multiplications
and the total number of complex additions in the FFT is
Complex additions
NlogN2
12
NlogN 2
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
34
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
If one complex multiplication requires
4 real multiplications
2 real additions
the FFT requires totally
2N log2N real multiplications and
2N log2N real additions
Brief Reasons
18
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
35
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
e.g. N = Sequence lengthM’ = number of multiplication per pointA’ = number of additions per point
N = 1024 (210) complex data
* refers to the case that 1 complex multiplication is equivalent to 4 real multiplications and 2 real additions
+ refers to the case that 1 complex multiplication is equivalent to 3 real multiplications and 3 real additions
1520101024A’
152051024M’
FFT+
(real)orFFT*
(real)FFT
(complex)
DFT(complex)
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
36
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
For an optimized arrangement, we can have
N = 1024
M’ 10
A’ 30
.)etc,jW,1W( 4
N0
19
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
37
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
Decimation in Frequency decomposition:~~ a second form of the FFT ~~
(i) Different from the Decimation-in-Time (DIT) FFT, the Decimation-in-Frequency FFT tries to decimate (to extract even and odd terms) the frequency domain results to form the fast algorithm.
(ii) Furthermore we will start by simply splitting the N-point input sequence {x(n)} into two -point sequences: {x(n)} and , corresponding respectively to the first samples and the last samples of {x(n)}.2
N)}n(x{ 2
N2N
2N
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
38
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
i.e.
for k=0,1,…, N-1
Then consider the even and odd-numbered values of X(k) separately.
1N
0n
nkW)n(x)k(X
nk
12
N
0n
k2
N
W)2
Nn(xW)n(x
12
N
0n
12
N
0n
k)2
Nn(nk W)
2
Nn(xW)n(x
1
2
N
0n
12
N
0n
nkk2
Nnk W)
2
Nn(xWW)n(x
20
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
39
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
For k even, replacing k by 2k, we obtain
for
Replacing k by 2k+1 for k = odd, we have
nk2
12
N
0n
W)2
Nn(x)n(x)k2(X
12
N,,1,0k
nk2n
12
N
0n
WW)2
Nn(x)n(x
12
N,,1,0kfor
)1k2(n
12
N
0n
)1k2(W)
2
Nn(xW)n(x)1k2(X 2
N
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
40
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
)7(x)3(x
)6(x)2(x
)5(x)1(x
)4(x)0(x
wwww
wwww
wwww
wwww
)6(X
)4(X
)2(X
)0(X
91
61
31
01
61
41
21
01
31
21
11
01
01
01
01
01
)7(x)3(x
)6(x)2(x
)5(x)1(x
)4(x)0(x
w000
0w00
00w0
000w
wwww
wwww
wwww
wwww
)7(X
)5(X
)3(X
)1(X
31
21
11
01
91
61
31
01
61
41
21
01
31
21
11
01
01
01
01
01
nk2
12
N
0n
W)2
Nn(x)n(x)k2(X
nk2n
12
N
0n
WW)2
Nn(x)n(x)1k2(X
21
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
41
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
Decimation in frequency signal flow graph, N = 8
x(0)
x(1)
x(2)
x(3)
x(4)
x(5)
x(6)
x(7)
-1
-W2 W
2
-W1
W1
W3
-W3
-1
-1
-1
-1
-1
W2
-W2
W2
-W2
X(0)
X(4)
X(2)
X(6)
X(1)
X(5)
X(3)
X(7)
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
42
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
Flow graph of a typical butterfly computation (DIF)
-1
A
B
A’
B’Wr
22
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
43
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
Comments on the FFT:
Advantages:(i) Reasonably good saving in terms of computation, i.e. it
is efficient(ii) Short Program required(iii) Easy to understand
Disadvantages:(i) A relatively large number of operations still required,
especially multiplications(ii) Almost the same number of multiplications for both real
and complex input(iii) Problem of the generation of Wn’s for n=0,1,2,…N-1.
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
44
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
A Generalized Approach for the FFT
All FFT algorithms can be derived
from successive applications of a single
operation, and the representation of a one-
dimensional string of inputs as a two-
dimensional array.
1N
0n
nkW)n(x)k(X
23
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
45
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
To simplify its computation, let us consider
the General Criteria for mapping n and k
indices
n L1n1 + L2n2
k K1k1 + K2k2
Hence)kKkK)(nLnL(nk 22112211WW
2222121221211111 knKLknKLknKLknKLW 2222121221211111 knKLknKLknKLknKL WWWW
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
46
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
In order to get rid of one twiddle factors,
We can let either
L1K2 = N, hence
L2K1 = N, hence
1WW 212121 kNnknKL
1WW 121212 kNnknKL
24
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
47
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
To transform the DFT equation into 2-dimensional form,
assume that, N = N2N1 and
let n n2 + N2n1
k N1k2 + k1
(i.e. L2 = 1, L1 = N2, K2 = N1 , K1 = 1
hence L1K2 = N)
)kkN)(nNn(nk 121122WW 11212221 knNknknN WWW
22112
2
2
1
1
112 knNkn1N
0n
1N
0n
knN1212 WWW)n,n(x)k,k(X
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
48
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
Let us further assume that N2 = 2,
Hence N = 2N1 and N1 =
let n n2 + 2n1
k k2 + k1
(i.e. L2 = 1, L1 = 2, K2 = , K1 = 1 hence L1K2 = N)
)k2/Nk)(n2n(nk 1212WW
111222 kn2kn2/kNn WWW
2/kNnkn12
0n
12/N
0n
kn21212
2212
2 1
11 WWW)n,n(x)k,k(X
2N
2N
2N
Appendix B:Mapping
25
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
49
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
This becomes the Equation for
Decimation-In-Time decomposition (DIT) algorithm.
We have transformed a length-N DFT into 2 length-½NDFTs at the expenses of two Twiddle Factor multiplications and two additions.
12/N
0n
kn21
12/N
0n
kkn211
1
11
1
111 W)n,1(xWW)n,0(x)k,0(X
12/N
0n
kn21
12/N
0n
kkn211
1
11
1
111 W)n,1(xWW)n,0(x)k,1(X
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
50
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
Recall again:We have transformed a length-N DFT into 2 length-DFTs at the expenses of N Twiddle Factor multiplications and N additions. This is considered as a one stage decomposition.
For the second stage, the same procedure can be done, hence a length- DFT can also be decomposed into 2 length- DFTs at the expenses of Twiddle Factor multiplications and additions. However, there are 2 length- DFTs to be computed; hence the total numbers of multiplications and addition are respectively also N.
This is the essence of the FFT.
2N
2N
4N
2N
2N
26
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
51
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
Example: For N=8 with DIT decomposition,
assume N = N2N1 = 2 x 4 and
Hence n n2 + 2n1
k 4k2 + k1
(i.e. L2 = 1, L1 = 2, K2 = 4, K1 = 1 hence L1K2 = 8 = N)
)kk4)(n2n(nk 1212WW
111222 kn2knkn4 WWW
2212
2 1
11 kn4kn12
0n
14
0n
kn21212 WWW)n,n(x)k,k(X
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
52
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
This result is the same as before:
the decimation in time decomposition algorithm.
14
0n
kn21
14
0n
kkn211
1
11
1
111 W)n,1(xWW)n,0(x)k,0(X
14
0n
kn21
14
0n
kkn211
1
11
1
111 W)n,1(xWW)n,0(x)k,1(X
27
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
53
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
Diagram showing the decomposition:
The total number of multiplications = multiplications per stage x the Number of stages= N x log2N
Similarly, the total number of adds = N x log2N
2N
4N
2N
N
4N
4N
4N
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
54
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
Decimation-in-frequency Algorithm (DIF)Similarly, we can define the following mappings for the DIF algorithm.
n 4n2 + n1
k k2 + 2k1
(i.e. L2 = 4, L1 = 1, K2 = 1, K1 = 2, hence L2K2 = 8 = N)
112122 kn2knkn4nk WWWW
2221
2 1
11 kn4kn12
0n
14
0n
kn21212 WWW)n,n(x)k,k(X
Appendix B:Mapping
28
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
55
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
and
Equation for decimation in frequency decomposition algorithm
14
0n
kn2111
1
11W)n,1(x)n,0(x)k,0(X
14
0n
kn2n111
1
111WW))n,1(x)n,0(x()k,1(X
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
56
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
1. We have recall the properties of DFT, in particular
(i) DFT Kernel,
(ii) Circulant Property
X(-k) = X(N-k)
X(rN+k) = X(k), for r = integer
N
2j
eW
,1W0
,1WrN
,1W 2N
and,jW 4N
jW 4N3
Chapter Summary (Chapter 9)
29
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
57
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
2. Decimation-In-Time FFT
(i) To decimate the time-domain signal representation of the sequence,
x1(n) = {x(0), x(2), x(4), ….}
x2(n) = {x(1), x(3), x(5), ….}
(ii) This gives a resultant formulation as shown below,
X(k) = X1(k) + Wk X2(k)
for and
1N
0n
nk111
1
W)n(x)k(X
1N
0n
nk122
1
W)n(x)k(X
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
58
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
3. Decimation-In-Frequency FFT
(i) To decimate the frequency-domain signal representation of the sequence,
X1(k) = X (2k), for k = 0, 1, 2, …(N/2-1)
X2(k) = X(2k+1), for k = 0, 1, 2, …(N/2-1)
(ii) This gives a resultant formulation as shown below,
nk2
12
N
0n
W)2
Nn(x)n(x)k2(X
nk2n
12
N
0n
WW)2
Nn(x)n(x)1k2(X
30
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
59
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
4. Number of operations
(i) For DFT:
Multiplications: M = N2, the order of N2
Additions: A = N(N-1), also the order of N2
(complex operations)
(ii) For FFT
Multiplications: ½ Nlog2N, the order of log2N
Additions: N log2N, also the order of log2N
(complex operations)
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
60
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
5. Realisation using Butterflies
(i) Butterflies for DIT-FFT
(ii) Butterflies for DIF-FFT
-1
A
B
A’
B’Wr
-1
A
B
A’
B’Wr
31
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
61
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
6. Generalized formulation for the FFT
(i) For DIT-FFT:
let n n2 + 2n1
k ½ N k2 + k1
1
0n
kn21
k1
0n
kn211
2N
1
111
2N
1
11 W)n,1(xWW)n,0(x)k,0(X
1
0n
kn21
k1
0n
kn211
2N
1
111
2N
1
11 W)n,1(xWW)n,0(x)k,1(X
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
62
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
6. Generalized formulation for the FFT (con’t)
(ii) For DIF-FFT
n ½Nn2 + n1
k k2 + 2k1
and
1
0n
kn2111
2N
1
11W)n,1(x)n,0(x)k,0(X
1
0n
kn2n111
2N
1
111WW)n,1(x)n,0(x)k,1(X
32
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
63
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
The Endof Chapter 6
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
64
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
Appendix: Complex number multiplication
Consider
x = x0 + jx1
w = w0 + jw1
Approach 1 (Direct Approach)
y = y0 + jy1 = (x0 + jx1)(w0 + jw1)
= (x0w0 - x1w1) +j(x0w1 + x1w0)
4 multiplications and 2 additions
or y0 = x0w0 - x1w1
y1 = x0w1 + x1w0
33
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
65
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
Approach 2
Let a0 = x0 + x1
b1 = w0 + w1 Pre-multiplication
b2 = w1 – w0 additions
m0 = a0w0
m1 = x1b1
m2 = x0b2
hence
y0 = m0 – m1 (= x0w0 – x1w1)
y1 = m0 + m2 (= x0w1 + x1w0)
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
66
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
Hence it involves
3 multiplications and 5 additions
(if additions for bi’s are counted)
3 multiplications and 3 additions
(if additions for bi’s are not counted)
34
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
67
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
The Endof Chapter 6
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
68
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
For example if N =8, and let also N = N2N1 = 2 x 4,
n n2 + 2n1
k 4k2 + k1for n1, k1 = 0,1,..3
n2, k2 = 0,1Or (n2 ,n1) n
(0,0) 0(0,1) 2(0,2) 4(0,3) 6(1,0) 1(1,1) 3(1,2) 5
(1,3) 7 How about (k2,k1) ?
This is actually the Radix-2 algorithm.
Note: x(0) = x(0,0)x(1)= x(1,0)x(2) = ?..
35
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
69
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
For example let also N = N2N1 = 2 x 4,
n n2 + 2n1
k 4k2 + k1for n1, k1 = 0,1,..3
n2, k2 = 0,1Or (n2 ,n1) n
(0,0) 0(0,1) 2(0,2) 4(0,3) 6(1,0) 1(1,1) 3(1,2) 5(1,3) 7 How about (k2,k1) ?
k 4k2 + k1 Or (k2 ,k1) k
(0,0) 0(0,1) 1(0,2) 2(0,3) 3(1,0) 4(1,1) 5(1,2) 6(1,3) 7
Return
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
70
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
Find the mapping for N = N2N1 = 2 x8,
n 8n2 + n1
k k2 + 2k1
for n1, k1 = 0,1,..7n2, k2 = 0,1
This is actually the Radix-2 algorithm,
Decimation-in-Frequency Algorithm.
Or (n2 ,n1) n(0,0) 0
Or (k2 ,k1) n
(0,0) 0
(0,1) 2
36
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
71
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
Find the mapping for N = N2N1 = 2 x8,
n 8n2 + n1
k k2 + 2k1 for n1, k1 = 0,1,..7n2, k2 = 0,1
Or (n2 ,n1) n(0,0) 0(0,1) 1(0,2) 2(0,3) 3(0,4) 4(0,5) 5(0,6) 6(0,7) 7(1,0) 8(1,1) 9(1,2) 10(1,3) 11(1,4) 12(1,5) 13(1,6) 14(1,7) 15
k k2 + 2k1Or (k2 ,k1) n
(0,0) 0
(0,1) 2
(0,2) 4(0,3) 6
(0,4) 8
(0,5) 10
(0,6) 12
(0,7) 14
(1,0) 1
(1,1) 3
(1,2) 5
(1,3) 7
(1,4) 9(1,5) 11
(1,6) 13
(1,7) 15
Return-DIT
Return-DIF
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
72
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
The Endof Chapter 6
37
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
73
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
Number of Complex Multiplications is
M = ½ N log2NNow each complex multiplication requires
4 real multiplications and 2 real additions
For this complex multiplications, we requireMreal = (½ N log2N).4 real multiplications
= 2N log2N real multiplications
Areal = (½ N log2N).2 real adds= N log2N real adds
Number of Complex Adds required is
A = N log2NObviously, each complex add requires
2 real additionHence the number of real adds for these complex adds becomes
Areal = (N log2N).2 real adds = 2N log2N real adds
Hence the total number of Adds becomesA = N log2N + 2N log2N
= 3N log2N
Return
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
74
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
The Endof Chapter 6
38
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
75
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
(i) for the 1st stage
X(k) = X1(k) +Wk X2(k)
for k = 0,1,…,7 W n = e2/N = e2/8
(ii) for the 2nd stage
for k = 0,1,2,3 (W1)n = (W2)n =e2.2/N = e2/4
(iii) for the 3rd stage
for k = 0, 1 and (W2)
n = (W12)n =e4.2/N = e2/2
k411 W)4(x)0(x)k(X
k412 W)6(x)2(x)k(X
k421 W)5(x)1(x)k(X
k422 W)7(x)3(x)k(X
3 Set of Equations: (p.21-24) Wn = Twiddle factor
)k(XW)k(X)k(X 12k2
111 )k(XW)k(X)k(X 22
k2212
Return, p.28
WCS\whw\DSP_2008_9-FFT.ppt\Feb2008
76
The Hong Kong Polytechnic UniversityDepartment of Electronic and Information Engineering
Prof. W.C. Siu Subject: Digital Signal Processing February 2008
The Endof Chapter 6