Fast Fourier Transform. Definition All Periodic Waves Can be Generated by Combining Sin and Cos...

Preview:

Citation preview

Fast Fourier TransformFast Fourier Transform

DefinitionDefinition

• All Periodic Waves Can be Generated All Periodic Waves Can be Generated by Combining Sin and Cos Waves of by Combining Sin and Cos Waves of Different FrequenciesDifferent Frequencies

• Number of Frequencies may not be Number of Frequencies may not be finitefinite

• Fourier Transform Decomposes a Fourier Transform Decomposes a Periodic Wave into its Component Periodic Wave into its Component FrequenciesFrequencies

DFT DefinitionDFT Definition

• Sample consists of n points, wave amplitude Sample consists of n points, wave amplitude at fixed intervals of time:at fixed intervals of time:(p(p00,p,p11,p,p22, ..., p, ..., pn-1n-1) (n is a power of 2)) (n is a power of 2)

• Result is a set of complex numbers giving Result is a set of complex numbers giving frequency amplitudes for sin and cos frequency amplitudes for sin and cos componentscomponents

• Points are computed by polynomial:Points are computed by polynomial:P(x)=pP(x)=p00+p+p11x+px+p22xx22+ ... +p+ ... +pn-1n-1xxn-1n-1

DFT Definition, continuedDFT Definition, continued

• The complete DFT is given byThe complete DFT is given byP(1), P(P(1), P(), P(), P(22), ... ,P(), ... ,P(n-1n-1))

• Must be a Primitive nth Root of UnityMust be a Primitive nth Root of Unity

• nn=1, if 0<i<n then =1, if 0<i<n then ii 1 1

Primitive Roots of UnityPrimitive Roots of Unity

• ii is an nth root of unity (not primitive)is an nth root of unity (not primitive)• n/2n/2 = -1 = -1• if 0if 0jjn/2-1 then n/2-1 then (n/2)+j(n/2)+j = - = -jj

• if n is even and if n is even and is a primitive nth root of is a primitive nth root of unity, then unity, then 22 is a primitive n/2 root of is a primitive n/2 root of unityunity

• Example: Example: == cos(2cos(2//nn) + ) + iisin(2sin(2//nn))

i

i

n

0

1

0 i

i

n

0

1

0

Divide and ConquerDivide and Conquer

• Compute an n-point DFT using one or Compute an n-point DFT using one or more n/2-point DFTsmore n/2-point DFTs

• Need to find Terms involving Need to find Terms involving 22 in in following polynomialfollowing polynomial

• P(P()=p)=p00+p+p11+p+p2222+p+p3333+p+p4444+ ... +p+ ... +pn-1n-1n-1n-1

Here They AreHere They Are

Even/Odd SeparationEven/Odd Separation

• P(P()= P)= P11(()+P)+P22(())

• PP11(()=p)=p00+p+p2222+p+p4444+ ... +p+ ... +pn-2n-2n-2n-2

• PP11(()=P)=Pe e ((22)=p)=p00+p+p22+p+p4411+...+p+...+pn-2n-2(n-2)/2(n-2)/2

• PP22(()=p)=p11+p+p3333+p+p5555+ ... +p+ ... +pn-1n-1n-1n-1

• PP22(()= )= P P33(()=p)=p11+p+p3322+... +p+... +pn-1n-1n-2n-2

• PP33(()=P)=Poo((22)= p)= p11+p+p33+... +p+... +pn-1n-1(n-2)/2(n-2)/2

• P(P()= P)= Pee((22)+ )+ PPoo((22))

• PPe e & P& Po o come from n/2 point FFTscome from n/2 point FFTs

The AlgorithmThe AlgorithmDFFT(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 2k-1-1 Do x := Odds[j]*mj

DFFT[j] := Evens[j] + x DFFT[2k-1+j] := Evens[j] - x End For End Ifend

Iterative AlgorithmIterative AlgorithmFor i := 0 To n-2 By 2 DoFor i := 0 To n-2 By 2 Do T[i] = p[T[i] = p[f(i)f(i)] + p[] + p[f(t+1)f(t+1)];]; T[i+1] := p[T[i+1] := p[f(i)f(i)] - p[] - p[f(t+1)f(t+1)];];End ForEnd Form := n/2; n := 2;m := n/2; n := 2;For k := lg n - 2 To 0 By -1 DoFor 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 (2For i := 0 To (2kk-1)*n By n Do-1)*n By n Do For j := 0 To (n/2)-1 DoFor j := 0 To (n/2)-1 Do x := x := mjmj * T[i+n/2+j]; * 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 ForEnd For End ForEnd ForEnd ForEnd For

What is f(i)?What is f(i)?

000000 000 000 -- 000 000 000 000 - - 000000 000000

001001 010 010 -- 010010 100 100 - 100- 100 100100

010010 100 100 - - 100100 010 - 010 - 010010 010010

011011 110 110 - 110- 110 110110 - 110- 110 110110

100100 001 - 001 - 001001 001001 - - 001001 001001

101101 011 - 011011 - 011 101101 - 101 - 101 101101

110110 101 - 101 - 101101 011 - 011 - 011011 011011

111111 111 - 111111 - 111 111 - 111111 - 111 111111

i f(i)

Recommended