Académique Documents
Professionnel Documents
Culture Documents
05
Informal Development of Fast Fourier Transform
(FFT)
Introduction
Recalled the DFT pairs of Equations (22) and (23) (of Chapter 11.04) and swapping the
indices n, k one obtains:
2
k
N 1
in w0 =
~
C n = f ( k )e N
(1)
k =0
1 N 1 ~ in w0 = k
(2)
f ( k ) = C n e N
N n =0
where n, k = 0,1,2,3,...N 1
(3)
While the above DFT pairs of equations are convenient for computer implementation, they
still require substantial computation effort. The objective of this chapter, therefore, is to
develop the improved version of DFT (namely Fast Fourier Transform, or FFT) so that much
larger sampling data can be handled more efficiently.
Let
i
(4)
(5)
1 ~
f (k ) = C n E nk
N n =0
It should be emphasized here that in performing interpolation, one usually has to solve a
system of equations to determine the unknown coefficients of the linear combination of basis
functions that fit the given data. For example, if N = 4 , then one need to solve the following
~
system (see the second part of Equation (5)), for obtaining C , with a given vector { f }.
~
1
1 C (0) f (0)
1 1
~
1
E 2 E 3 C (1) f (1)
1 1 E
(5a)
~ =
2
E 4 E 6 C (2) f (2)
N 1 E
~
3
E 6 E 9 C (3) f (3)
1 E
{}
11.05.1
11.05.2
Chapter 11.05
However, the inverse of the above coefficient matrix can be easily obtained as
1
1
1
1
1
1 1
1 1
1 E 1 E 2 E 3
1 E 1 E 2 E 3
1
=
N 1 E 2 E 4 E 6
1 E 2 E 4 E 6
3
3
6
E 6 E 9
E9
1 E E
1 E
~
Thus, the unknown vector C can be computed as matrix times vector operations, as
following:
Assuming N = 4 = 2 ( r = 2 ) , then (see the first part of Equation (5))
~
C (0) E ( 0 )( 0 ) E ( 0 )(1) E ( 0 )( 2 ) E ( 0 )(3) f (0)
~ (1)(0 )
~ = ( 2 )( 0 )
E ( 2 )(1) E ( 2 )( 2 ) E ( 2 )(3) f (2)
C (2) E
C~ (3) E (3)( 0 ) E (3)(1) E (3)( 2 ) E (3)(3) f (3)
~
C (0) E 0 E 0 E 0 E 0 f (0)
~ 0
E 1 E 2 E 3 f (1)
C (1) E
(7)
~ = 0
2
4
6
C (2) E E E E f (2)
C~ (3) E 0 E 3 E 6 E 9 f (3)
{}
iN2 2
E
= e
i 2
= e
E2
= E2
The term inside the square bracket is equal to 1, since
[e i 2 ] = cos(2 ) + i sin( 2 )
= cos(2 ) i sin( 2 )
= 1 i (0) = 1
For N = 4 , n = 3 and k = 3 , then
E nk = E 9
= [ E 8 ]E 1
= [ E 2 N ]E 1
i 2 2 N 1
= e N
E
i 4
1
= e
E
=E
11.05.3
In the above equation, one should recall the following Euler identity
e i 4 = Cos (4 ) iSin(4 )
=1
Thus, in general (for nk N )
E nk = E U
where
(8)
U = mod(nk , N )
nk
= remainder of
N
Remarks:
Matrix times vector, shown in Equation (7), will require 16 (or N 2 ) complex multiplications
and 12 (or N * ( N 1) ) complex additions.
Usage of Equation (8) will help to reduce the number of operation counts, as explained in the
next section.
Factorized Matrix and Further Operation Count
Equation (7) can be factorized as:
~
C (0) 1 E 0 0 0 1 0 E 0 0 f (0)
~
0
2
C (2) 1 E 0 0 0 1 0 E f (1)
(9)
~ =
2
1
f
(
2
)
E
E
0
0
1
1
0
0
C
(
1
)
C~ (3) 0 0 1 E 3 0 1 0 E 2 f (3)
Remarks:
The theory behind the 2 matrices on the right hand side (RHS) of Equation (9) will be clearly
explained soon (see Equations 11 and 15, in chapter 11.06).
The order of the left-hand-side (LHS) vector has been changed, such as rows 2 and 3 have
been swapped.
Let the row-interchanged LHS vector be defined as
~
C (0)
~
~
C (2)
(10)
C ( n) = ~
C
(
1
)
C~ (3)
Now performing the inner-product (matrix times vector) on the RHS of Equation (9), one
obtains
f1 (0) 1 0 E 0 0 f (0)
f (1)
0
1 0 1 0 E f (1)
(11)
=
2
0 f (2)
f1 (2) 1 0 E
f1 (3) 0 1 0 E 2 f (3)
or
(11a)
f1 (0) = f (0) + E 0 f (2)
11.05.4
since
Chapter 11.05
f1 (1) = f (1) + E 0 f (3)
f1 (2) = f (0) E 0 f (2)
2
(11b)
(11c)
2
*2
4
E =e
= e i
= 1
= E 0
f1 (3) = f (1) + E 2 f (3)
(11d)
= f (1) E 0 f (3)
Equations (11a through 11d) for the inner matrix times vector requires 2 complex
multiplications and 4 complex additions.
In Equations (11a11d), E 0 is intentionally not reduced to the numerical value of 1.0 to
facilitate the discussions of more general cases.
Finally, performing the outer product (matrix times vector) on the RHS of Equation (9),
one obtains:
~
C (0) f 2 (0) 1 E 0 0 0 f1 (0)
~
2
C (2) f 2 (1) 1 E 0 0 f1 (1)
(13)
=
~ =
1
C (1) f 2 (2) 0 0 1 E f1 (2)
C~ (3) f 2 (3) 0 0 1 E 3 f1 (3)
or
(14a)
(14b)
(14c)
(14d)
= f1 (2) E 1 f1 (3)
Again, Equations (14a-14d) requires 2 complex multiplications and 4 complex additions.
Thus, the complete RHS of Equation (9) can be computed by only 4 complex multiplications
r
2
(or N = 4 ) and 8 complex additions (or Nr = 4 2 ). Since computational time is mainly
2
2
controlled by the number of multiplications, hence implementing Equation (9) will
significantly reduce the number of multiplication, as compared to direct matrix times vector
operations (as shown in Equation (7)).
For large value of data points ( = N ), the ratio of complex multiplications by using Equation
(7) and Equation (9) can be computed as
11.05.5
N2
2N
(15)
=
Nr r
2
For N = 2048 = 2 ( r =11) , Equation (15) gives
2(2048)
Ratio =
= 372.36 ,
11
which basically implies that the number of complex multiplications involved in Equation (9)
is about 372 times less than the one involved in Equation (7).
Ratio =
11.05.6
Chapter 11.05
11.05.7
11.05.8
Chapter 11.05
i ( N2=16 ) 4
= f1 (8) + f1 (12) e
E
[ ]
= f1 (8) + f1 (12) e i E 4
(17)
= f1 (8) f1 (12) E 4
Thus, the companion nodes f 2 (8) and f 2 (12) computation will require 1 complex
multiplication and 2 complex additions (see Equations (16-17)). The weighting factors for
the companion nodes [ f 2 (8) and f 2 (12) ] are E 4 (or E U ) and E 12 (or E
Thus, in general
U+
N
2
) , respectively.
N
)
2l
N
N
) = f l 1 (k ) E U f l 1 (k + l )
l
2
2
Skipping computation of certain nodes
f l (k +
11.05.9
(18)
(19)
N
" are separated by the distance.
2L
N
N
N
( = L ) , hence, at the Lth level, after every L node computation, then the next L nodes
2
2
2
will be skipped! (see Figure 2).
Determination of E U
The values of U can de determined by the following steps:
Step 1: Express the index k ( = 0,1,2,..., N 1 ) in binary form, using r bits. For k = 8 , L = 2
and r = 4 ; or N = 2 r = 2 4 = 16 , one obtains
k =8
= 1,0,0,0
= (1)2 r 1=3 + (0)2 2 + (0)21 + (0)20
Step2: Sliding this binary number r L = 4 2 = 2 positions to the right, and fill in zeros,
the results are
1,0,0,0 X , X ,1,0 0,0,1,0
It is important to realize that the results of Step 2 (0,0,1,0) is equivalent to express an integer
k
M = r L
2
8
= 42
2
=2
in the binary formats. In other words, M = 2 = (0,0,1,0) .
Step3: Reverse the order of the bits, then (0,0,1,0) becomes 0,1,0,0 = E . Thus,
U = (0)2 3 + (1)2 2 + (0)21 + (0)2 0
=4
It is NOT really necessary to perform Step 3, since the results of Step 2 can be used to
compute E as following
U = (0)2 0 + (0)21 + (1)2 2 + (0)2 3
=4
In conclusion, for N = 2 r = 2 4 = 16; L = 2; k = 8 and U = 4 ; the computation of companion
nodes from general formulas (see Equations (18) and (19)) gives
f 2 (8) = f1 (8) + E 4 f1 (12)
f 2 (12) = f1 (8) E 4 f1 (12)
The above 2 equations are identical to Equations (16) and (17).
11.05.10
Chapter 11.05
M
2
IDIFF = J1 JJ 2 = M
(21)
2 Truncated
or
a1 = 0
U = U 2 + IDIFF
= 0 2 + 0
=0
U = U + (a1 )2 r I
= 0 + (0)2 3
=0
Determine the bit a 2 [Index I = 2 ]
J1 = J 2
=1
J
J2 = 1
2
1
=
2
=0
IDIFF = J 1 ( JJ 2 = J 2 2)
= 1 (0 2)
=1
Thus a 2 = 1
U = U 2 + IDIFF
= 0 2 +1
=1
or
U = U + (a2 )2 r I
= 0 + (1)2 2
=4
Determine the bit a3 [Index I = 3 ]
J1 = J 2
=0
J
J2 = 1
2
0
=
2
=0
IDIFF = J 1 ( JJ 2 = J 2 2)
= 0 (0 2)
=0
Thus a3 = 0
U = U 2 + IDIFF
= 1 2 + 0
=2
11.05.11
11.05.12
or
Chapter 11.05
U = U + ( a3 ) 2 r I
= 4 + (0)21
=4
Determine the bit a 4 [Index I = 4 = r ]
J1 = J 2
=0
J
J2 = 1
2
0
=
2
=0
IDIFF = J 1 ( JJ 2 = J 2 2)
= 0 (0) 2
=0
Thus a 4 = 0
U = U 2 + IDIFF
= 2 2 + 0
=4
or
U = U + (a4 )2 r I
= 4 + (0)2 0
=4
Remarks:
Although the intermediate results might be different, at the end of the do-loop process
(computing a 4 ), both formulas for U , such as
(22)
U = U 2 + IDIFF ; or
r I
(23)
U = U + (a I )2 ; where U = 1,2,3,..., r
will eventually give the same final answers for U .
Example 2
For k = 12 ; N = 16 = 2 r = 4 ; and L = 3. Compute the corresponding value of U ?
One has
k
M = r L
2
12
= 4 3
2
J1 = J 2
=3
Determine the bit a1 : (Index I = 1 )
11.05.13
11.05.14
Chapter 11.05
1
2
=0
IDIFF = J 1 ( JJ 2 = J 2 2)
= 1 (0) 2
=1
Thus a3 = 1
U = U 2 + IDIFF
= 1 2 + 1
=3
or
U = U + ( a3 ) 2 r 3
=
= 4 + (1)21
=6
Determine the bit a 4 [Index I = 4 ]
J1 = J 2
=0
J
J2 = 1
2
0
=
2
=0
IDIFF = J 1 ( JJ 2 = J 2 2)
= 0 (0) 2
=0
Thus a 4 = 0
U = U 2 + IDIFF
= 3 2 + 0
=6
or
U = U + (a4 )2 r 4
= 6 + (0)2 0
=6
Remarks:
Although both formulas for U , shown in Equations (22) and (23), will yield the same
final value of U . Implementation of Equation (22) will be more computationally
efficient.
Unscrambling the FFT
For the case N = 16 = 2 r = 4 (see Figure 2), the final bit-reversing operation for FFT is
shown in Figure 3.
11.05.15
~
C ( n)
~
f 4 (0000)
C (0000)
f 4 (0001)
C (0001)
f 4 (0010)
f 4 (0011)
C (0010)
f 4 (0100)
C (0100)
f 4 (0101)
C (0101)
f 4 (0110)
C (0110)
f 4 (0111)
C (0111)
f 4 (1000)
C (1000)
f 4 (1001)
C (1001)
10
f 4 (1010)
C (1010)
11
f 4 (1011)
C (1011)
12
f 4 (1100)
C (1100)
13
f 4 (1101)
C (1101)
14
f 4 (1110)
C (1110)
15
f 4 (1111)
C (1111)
C (0011)
~
~
~
11.05.16
Chapter 11.05
If (i.GT .k )Then
T = f 4 (k )
f 4 (k ) = f 4 (i )
f 4 (i ) = T
Endif
Hence, f 4 (1) = f 4 (8) ; are swapped.
(24)
+ E U , R + iE U , I f LR1 (k + L ) + if LI1 (k + L )
2
2
In Equation (24), the superscripts R and I denote real and imaginary components,
respectively.
Multiplying the last 2 complex numbers, one obtains:
f LR (k ) + if LI (k ) = f LR1 (k ) + if LI1 (k )
N
N
+ E U , R f LR1 (k + L ) E U , I f LI1 (k + L )
2
2
N
N
(25)
+ i E U , R f LI1 (k + L ) + E U , I f LR1 (k + L )
2
2
Equating the real (and then, imaginary) components on the Left-Hand-Side (LHS), and the
Right-Hand-Side (RHS) of Equation (25), one obtains
} {
{f
} {
R
L
N
N
} {
(26a)
11.05.17
N
N
{f
Hence
} {
I
L
E =e
(26b)
2
N
i 2
E = e N
(27)
2U
=e N
= e i
= cos( ) i sin( )
where
2U
N
6.28U
=
N
Thus
(28)
(29a)
E U , R = cos( )
U ,I
(29b)
E = sin( )
Substituting Equations (29a, 29b) into Equations (26a, 26b), one gets
(30a)
{f LR (k )} = {f LR1 (k )}+ cos( ) f LR1 (k + 2NL ) + sin( ) f LI1 (k + 2NL )
N
N
(30b)
f LI (k ) = f LI1 (k ) + cos( ) f LI1 (k + L ) sin( ) f LR1 (k + L )
2
2
Similarly, the single (complex number) Equation (19) can be expressed as 2 equivalent (real
number) equations, such as equations (30a, 30b).
Listing of computer implementation of serial FFT algorithm is given at
http://numericalmethods.eng.usf.edu/simulations/mtl/11fft/general_fft.m
} {
References
[1] E.Oran Brigham, The Fast Fourier Transform, Prentice-Hall, Inc. (1974).
[2] S.C. Chapra, and R.P. Canale, Numerical Methods for Engineers, 4th Edition, Mc-Graw
Hill (2002).
[3] W.H . Press, B.P. Flannery, S.A. Tenkolsky, and W.T. Vetterling, Numerical Recipies,
Cambridge University Press (1989), Chapter 12.
[4] M.T. Heath, Scientific Computing, Mc-Graw Hill (1997).
[5] H. Joseph Weaver, Applications of Discrete and Continuous Fourier Analysis, John
Wiley & Sons, Inc. (1983).
11.05.18
Chapter 11.05