FFT Examples Let`s calculate the Discrete Fourier Transform (DFT

FFT Examples
Let’s calculate the Discrete Fourier Transform (DFT) of the sequence ~s = h1, 2, 3, 4, 5, 6, 7, 8i
using the Fast Fourier Transform (FFT).
(Remember, the FFT is just a fast algorithm for computing the DFT; unlike
DFT it is not a transform itself !!)
The associated polynomial is
P (x) = 1 + 2x + 3x2 + 4x3 + 5x4 + 6x5 + 7x6 + 8x7 ;
the DF T (~s) is just the sequence of values
DF T (~s) = hP (ω80 ), P (ω81 ), P (ω82 ), P (ω83 ), P (ω84 ), P (ω85 ), P (ω86 ), P (ω87 )i
Note that we have
√
2
2
+ ı˙
;
ω81 =
2
2
√
√
2
2
5
− ı˙
;
ω8 = −
2
2
ω80 = 1;
ω84 = −1;
√
2
2
+ ı˙
;
ω83 = −
2
2
√
√
2
2
7
− ı˙
;
ω8 =
2
2
√
√
ω82 = ı˙;
ω86 = − ı˙;
see Figure 1:
Figure 1.
Also,
ω40 = 1;
ω41 = ı˙;
ω42 = −1;
1
ω43 = − ı˙
2
ω20 = 1;
ω21 = −1.
We now proceed with the “Divide-And-Conquer” procedure: letting y = x2 we get
P (x) = 1 + 2x + 3x2 + 4x3 + 5x4 + 6x5 + 7x6 + 8x7
= (1 + 3x2 + 5x4 + 7x6 ) + x(2 + 4x2 + 6x4 + 8x6 )
= (1 + 3y + 5y 2 + 7y 3 ) + x(2 + 4y + 6y 2 + 8y 3 ).
We now let
Pe (y) = 1 + 3y + 5y 2 + 7y 3 ;
Po (y) = 2 + 4y + 6y 2 + 8y 3 ;
Continuing with “Divide-And-Conquer” strategy we get, letting z = y 2
Pe (y) = (1 + 5y 2 ) + y(3 + 7y 2 );
Po (y) = 2 + 6y 2 + y(4 + 8y 2 );
= (1 + 5z) + y(3 + 7z);
= 2 + 6z + y(4 + 8z).
We now let:
Pee (z) = 1 + 5z;
Peo (z) = 3 + 7z;
Poe (y) = 2 + 6z;
Poo (z) = 4 + 8z.
Note that, as powers of ωn rotate once around the circle, the powers of the squares
ωn2 = ω n2 rotate twice through only
n
2
many distinct values; for example, for n=8, using
the cancelation Lemma, i.e., (ωnk )2 = ω kn we get:
2
3
x=
ω80
ω81
ω82
x2 =
(ω80 )2
(ω81 )2
(ω82 )2
ω83
(ω83 )2
ω84
ω85
ω86
ω87
(ω84 )2
(ω85 )2
(ω86 )2
(ω87 )2
k
k
k
k
k
k
k
k
ω40
ω41
ω42
ω43
ω44
ω45
ω46
ω47
k
k
k
k
k
k
k
k
ω40
ω41
ω42
ω43
ω40
ω41
ω42
ω43
Thus, if
P (x) = P e (x2 ) + x P o (x2 )
(1)
and P (x) is of degree n − 1, then
n
P e ((ωnk )2 ) = P e ((ωn2
(2)
+k 2
n
+k
2
P o ((ωnk )2 ) = P o ((ωn
(3)
n
+k
2
ωn
(4)
=
) ) = P e (ω kn );
2
)2 ) = P o (ω kn );
2
−ωnk .
Consequently, from (1)–(3) we have the following recursion for every n of the form
n = 2m :
if
• ~s = hs0 , s1 , s2 , s3 , . . . , sn i;
• s~e = hs0 , s2 , s4 , . . . , sn i and s~o = hs1 , s3 , s5 , . . . , sn−1 i
(note: both of these sequences are of length n/2)
and if
• DF T (~s) = hf0 , f1 , f2 , f3 , . . . fn i
• DF T (s~e ) = hf0e , f1e , . . . , f ne i and DF T (s~o ) = hf0o , f1o , . . . , f no i;
2
2
4
then for all 0 ≤ k ≤
(5)
n
2
− 1 we have
fk = fke + ωnk fko ;
f n2 +k = fke + ω kn +k fko = fke − ωnk fko ;
2
We now compute
DF T (h1, 5i) = hPee (ω20 ), Pee (ω21 )i = hPee (1), Pee (−1)i
= h1 + 5 · 1, 1 + 5 · (−1)i = h6, −4i
DF T (h3, 7i) = hPeo (ω20 ), Peo (ω21 )i = hPeo (1), Peo (−1)i
= h3 + 7 · 1, 3 + 7 · (−1)i = h10, −4i
DF T (h2, 6i) = hPoe (ω20 ), Poe (ω21 )i = hPoe (1), Poe (−1)i
= h2 + 6 · 1, 2 + 6 · (−1)i = h8, −4i
DF T (h4, 8i) = hPoo (ω20 ), Poo (ω21 )i = hPoo (1), Poo (−1)i
= h4 + 8 · 1, 4 + 8 · (−1)i = h12, −4i
We now use equations (5) with n = 4 to start putting things together:
DF T (h1, 3, 5, 7i) = h6 + ω40 · 10, −4 + ω41 (−4), 6 − ω40 · 10, −4 − ω41 (−4)i
= h6 + 10, −4 + ı˙(−4), 6 − 10, −4 − ı˙(−4)i
= h16, −4 − 4 ı˙, −4, −4 + 4 ı˙i
DF T (h2, 4, 6, 8i) = h8 + ω40 · 12, −4 + ω41 (−4), 8 − ω40 · 12, −4 − ω41 (−4)i
= h8 + 12, −4 + ı˙(−4), 8 − 12, −4 − ı˙(−4)i
= h20, −4 − 4 ı˙, −4, −4 + 4 ı˙i
Finally we obtain from (5) with n = 8,
DF T (h1, 2, 3, 4, 5, 6, 7, 8i) = h16 + ω80 · 20, −4 − 4 ı˙ +ω81 (−4 − 4 ı˙), −4 + ω82 · (−4), −4 + 4 ı˙ +ω83 (−4 + 4 ı˙),
16 − ω80 · 20, −4 − 4 ı˙ −ω81 (−4 − 4 ı˙), −4 − ω82 · (−4), −4 + 4 ı˙ −ω83 (−4 + 4 ı˙)i
5
√
√ !
√
√ !
2
2
2
2
16 + 1 · 20, −4 − 4 ı˙ +
+ ı˙
(−4 − 4 ı˙), −4 + ı˙ ·(−4), −4 + 4 ı˙ + −
+ ı˙
(−4 + 4 ı˙),
2
2
2
2
+
√
√ !
√
√ !
2
2
2
2
16 − 1 · 20, −4 − 4 ı˙ −
+ ı˙
(−4 − 4 ı˙), −4 − ı˙ ·(−4), −4 + 4 ı˙ − −
+ ı˙
(−4 + 4 ı˙)
2
2
2
2
*
=
= h36, −4 − 4 ı˙(1 +
√
2), −4 − 4 ı˙, −4 + 4 ı˙(1 −
√
2), −4, −4 − 4 ı˙(1 −
√
2), −4 + 4 ı˙, −4 + 4 ı˙(1 +
Another example
Previous example might have resulted in confusingly symmetric calculations, so let us
compute the DFT of the sequence h1, 8, 4, 3, 2, 5, 6, 7i. The corresponding polynomial is
now
Q(x) = 1 + 8x + 4x2 + 3x3 + 2x4 + 5x5 + 6x6 + 7x7
= 1 + 4x2 + 2x4 + 6x6 + x(8 + 3x2 + 5x4 + 7x6 ).
Substituting y = x2 we get
Q(x) = 1 + 4y + 2y 2 + 6y 3 + x(8 + 3y + 5y 2 + 7y 3 ).
We let
Qe (y) = 1 + 4y + 2y 2 + 6y 3 ;
Qo (y) = 8 + 3y + 5y 2 + 7y 3 ;
We now have with substitution z = y 2
Qe (y) = 1 + 2y 2 + y(4 + 6y 2 );
= 1 + 2z + y(4 + 6z);
Qo (y) = 8 + 5y 2 + y(3 + 7y 2 );
= 8 + 5z + y(3 + 7z);
We let
Qee (y) = 1 + 2z;
Qeo (y) = 4 + 6z;
Qoe (y) = 8 + 5z;
Qoo (y) = 3 + 7z;
√
2)i
6
We now have:
DF T (h1, 2i) = hQee (ω20 ), Qee (ω2 )i = hQee (1), Qee (−1)i = h3, −1i;
DF T (h4, 6i) = hQeo (ω20 ), Qeo (ω2 )i = hQeo (1), Qeo (−1)i = h10, −2i;
DF T (h8, 5i) = hQoe (ω20 ), Qoe (ω2 )i = hQee (1), Qee (−1)i = h13, 3i;
DF T (h3, 7i) = hQoo (ω20 ), Qoo (ω2 )i = hQee (1), Qee (−1)i = h10, −4i.
We now use equations (5) with n = 4 to start putting things together:
DF T (h1, 4, 2, 6i) = h3 + ω40 · 10, −1 + ω41 (−2), 3 − ω40 · 10, −1 − ω41 (−2)i
= h3 + 10, −1 + ı˙(−2), 3 − 10, −1 − ı˙(−2)i
= h13, −1 − 2 ı˙, −7, −1 + 2 ı˙i
DF T (h8, 3, 5, 7i) = h13 + ω40 · 10, 3 + ω41 (−4), 13 − ω40 · 10, 3 − ω41 (−4)i
= h13 + 10, 3 + ı˙(−4), 13 − 10, 3 − ı˙(−4)i
= h23, 3 − 4 ı˙, 3, 3 + 4 ı˙i
Finally, from (5) with n = 8 we obtain
DF T (h1, 8, 4, 3, 2, 5, 6, 7i) = h13 + ω80 · 23, −1 − 2 ı˙ +ω81 (3 − 4 ı˙), −7 + ω82 · 3, −1 + 2 ı˙ +ω83 (3 + 4 ı˙),
13 − ω80 · 23, −1 − 2 ı˙ −ω81 (3 − 4 ı˙), −7 − ω82 · 3, −1 + 2 ı˙ −ω83 (3 + 4 ı˙)i
*
= 13 + 1 · 23, −1 − 2 ı˙ +
13 − 1 · 23, −1 − 2 ı˙ −
*
= 36,
√ !
√
√ !
√
2
2
2
2
+ ı˙
(3 − 4 ı˙), −7 + ı˙ ·3, −1 + 2 ı˙ + −
+ ı˙
(3 + 4 ı˙),
2
2
2
2
+
√
√
√ !
√ !
2
2
2
2
(3 − 4 ı˙), −7 − ı˙ ·3, −1 + 2 ı˙ − −
(3 + 4 ı˙)
+ ı˙
+ ı˙
2
2
2
2
√
√
−2 + 7 2
4+ 2
− ı˙
, −7 + 3 ı˙,
2
2
√
√
−2 − 7 2
4− 2
−10,
− ı˙
,
2
2
√
√
−2 − 7 2
4− 2
+ ı˙
,
2
2
√
√ +
−2 + 7 2
4+ 2
−7 − 3 ı˙,
+ ı˙
2
2