Fast Fourier Transform
Definition All Periodic Waves Can be Generated by Combining Sin and Cos Waves of Different FrequenciesAll Periodic Waves Can be Generated by Combining Sin and Cos Waves of Different Frequencies Number of Frequencies may not be finiteNumber of Frequencies may not be finite Fourier Transform Decomposes a Periodic Wave into its Component FrequenciesFourier Transform Decomposes a Periodic Wave into its Component Frequencies
DFT Definition Sample consists of n points, wave amplitude at fixed intervals of time: (p 0,p 1,p 2,..., p n-1 ) (n is a power of 2)Sample consists of n points, wave amplitude at fixed intervals of time: (p 0,p 1,p 2,..., p n-1 ) (n is a power of 2) Result is a set of complex numbers giving frequency amplitudes for sin and cos componentsResult is a set of complex numbers giving frequency amplitudes for sin and cos components Points are computed by polynomial: P(x)=p 0 +p 1 x+p 2 x p n-1 x n-1Points are computed by polynomial: P(x)=p 0 +p 1 x+p 2 x p n-1 x n-1
DFT Definition, continued The complete DFT is given by P(1), P( ), P( 2 ),...,P( n-1 )The complete DFT is given by P(1), P( ), P( 2 ),...,P( n-1 ) Must be a Primitive nth Root of Unity Must be a Primitive nth Root of Unity n =1, if 0<i<n then i 1 n =1, if 0<i<n then i 1
Primitive Roots of Unity i is an nth root of unity (not primitive) i is an nth root of unity (not primitive) n/2 = -1 n/2 = -1 if 0 j n/2-1 then (n/2)+j = - jif 0 j n/2-1 then (n/2)+j = - j if n is even and is a primitive nth root of unity, then 2 is a primitive n/2 root of unityif n is even and is a primitive nth root of unity, then 2 is a primitive n/2 root of unity Example: = cos(2 /n) + isin(2 /n)Example: = cos(2 /n) + isin(2 /n)
Divide and Conquer Compute an n-point DFT using one or more n/2-point DFTsCompute an n-point DFT using one or more n/2-point DFTs Need to find Terms involving 2 in following polynomialNeed to find Terms involving 2 in following polynomial P( )=p 0 +p 1 +p 2 2 +p 3 3 +p 4 p n-1 n- 1P( )=p 0 +p 1 +p 2 2 +p 3 3 +p 4 p n-1 n- 1 Here They Are
Even/Odd Separation P( )= P 1 ( )+P 2 ( )P( )= P 1 ( )+P 2 ( ) P 1 ( )=p 0 +p 2 2 +p 4 p n-2 n-2P 1 ( )=p 0 +p 2 2 +p 4 p n-2 n-2 P 1 ( )=P e ( 2 )=p 0 +p 2 +p 4 p n-2 (n-2)/2P 1 ( )=P e ( 2 )=p 0 +p 2 +p 4 p n-2 (n-2)/2 P 2 ( )=p 1 +p 3 3 +p 5 p n-1 n-1P 2 ( )=p 1 +p 3 3 +p 5 p n-1 n-1 P 2 ( )= P 3 ( )=p 1 +p 3 p n-1 n-2P 2 ( )= P 3 ( )=p 1 +p 3 p n-1 n-2 P 3 ( )=P o ( 2 )= p 1 +p 3 p n-1 (n-2)/2P 3 ( )=P o ( 2 )= p 1 +p 3 p n-1 (n-2)/2 P( )= P e ( 2 )+ P o ( 2 )P( )= P e ( 2 )+ P o ( 2 ) P e & P o come from n/2 point FFTsP e & P o come from n/2 point FFTs
The Algorithm DFFT(P:Array;k,m:Integer):Array; begin If k=0 Then DFFT[0]=P[0];DFFT[1]=P[0]; Else Evens = DFFT(EvenElemOf(P),k-1,2m); Odds = DFFT(OddElemOf(P),k-1,2m); For i := 0 to 2 k-1 -1 Do x := Odds[j]* mj DFFT[j] := Evens[j] + x DFFT[2 k-1 +j] := Evens[j] - x End For End If end
Iterative Algorithm For i := 0 To n-2 By 2 Do T[i] = p[f(i)] + p[f(t+1)]; T[i] = p[f(i)] + p[f(t+1)]; T[i+1] := p[f(i)] - p[f(t+1)]; T[i+1] := p[f(i)] - p[f(t+1)]; End For m := n/2; n := 2; For k := lg n - 2 To 0 By -1 Do m := m/2; n := 2*n; m := m/2; n := 2*n; For i := 0 To (2 k -1)*n By n Do For i := 0 To (2 k -1)*n By n Do For j := 0 To (n/2)-1 Do For j := 0 To (n/2)-1 Do x := mj * T[i+n/2+j]; x := mj * T[i+n/2+j]; T[i+n/2+j] := T[i+j] - x; T[i+n/2+j] := T[i+j] - x; T[i+j] := T[i+j] + x; T[i+j] := T[i+j] + x; End For End For End For
What is f(i)? if(i)