signal processing fundamentals – part i spectrum analysis ...enpklun/eie327/fft2.pdf · 14 signal...

26
1 6. 6. Fast Fourier Transform Fast Fourier Transform Signal Processing Fundamentals – Part I Spectrum Analysis and Filtering 6. Fast Fourier Transform -1 x[0] x[4] x[2] x[6] x[1] x[5] x[3] x[7] X[0] X[1] X[2] X[3] X[4] X[5] X[6] X[7] W N 3 W N 2 W N 1 W N 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 W N 1 W N 0 W N 1 W N 0

Upload: others

Post on 26-Jan-2021

14 views

Category:

Documents


0 download

TRANSCRIPT

  • 1

    6.6. Fast Fourier TransformFast Fourier Transform

    Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering

    6. Fast Fourier Transform

    -1

    x[0]

    x[4]x[2]

    x[6]

    x[1]

    x[5]x[3]

    x[7]

    X[0]

    X[1]X[2]

    X[3]

    X[4]

    X[5]X[6]

    X[7]WN3WN2WN1WN0

    -1

    -1

    -1

    -1

    -1

    -1

    -1

    -1

    -1

    -1-1WN1

    WN0

    WN1WN0

  • 2

    A Historical Perspective

    • The Cooley and Tukey Fast Fourier Transform (FFT) algorithm is a turning point to the computation of DFT

    • Before that, DFT was never practical except running by some very expensive computers

    • FFT gives nearly a factor of 1000 improvement in the computation speed over the traditional approach in most computing environments

    Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering

    6. Fast Fourier Transform

  • 3

    Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering

    6. Fast Fourier Transform

    • Principal discoveries of efficient methods of computing the DFT are listed as follows:

    Researcher(s) Date Feature

    Cooley & Tukey 1965 Any 2n composite integer

    I.J. Good 1958 Any integer with relatively prime factors

    L.H. Thomas 1948 Any integer with relatively prime factors

    Danielson 1942 2n

    K. Stumpff 1939 2nk, 3nk

    C. Runge 1903 2nk

    J.D. Everett 1860 12

    A. Smith 1846 4, 8, 16, 32

    F. Carlini 1828 12

    C.F. Gauss 1805 Any composite integer

  • 4

    Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering

    6. Fast Fourier Transform

    • Basic principle of FFT

    Divide and Conquer

    )(cost)(cost)(cost

    problemoriginaloverheadssubproblem

    <

    +∑• Need to satisfy the following criterion

    ⇒ To break down a big problem to a number of smaller problems and tackle them individually

  • 5

    Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering

    6. Fast Fourier Transform

    )(cost)(cost)(cost

    problemoriginaloverheadssubproblem

    <

    +∑

    Big Problem SmallerProblem

    SmallerProblem

    SmallerProblems

    OverheadApply Divide and Conquer iteratively

  • 6

    Operation of FFT

    Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering

    6. Fast Fourier Transform

    Length-N/4 DFTs

    For each round, the size of the problem is divided by 2

    Length-N DFT Length-N/2DFT

    Length-N/2DFT

    Overhead

  • 7

    Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering

    6. Fast Fourier Transform

    Mathematical Derivation• Recall the DFT of x[n], for n = 0, 1,…,N-1

    ∑−

    ==

    1

    0][][

    N

    n

    nkNWnxkX

    • Separate the summation into two groups

    ∑∑ +=nodd

    nkN

    neven

    nkN WnxWnxkX ][][][

    for k = 0, 1,…,N-1

    for k = 0, 1,…,N-1

    NnkjnkN eWwhere

    /2π−=

  • 8

    Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering

    6. Fast Fourier Transform

    Example• If DFT of x[n] is

    kkkk WxWxWxWxkX .34.2

    4.1

    4.0

    4 ]3[]2[]1[]0[][ +++=

    • We separate it into two groups with odd and even n

    { } { }∑∑ +=

    +++=

    nodd

    nk

    neven

    nk

    kkkk

    WnxWnx

    WxWxWxWxkX

    44

    .34

    .14

    .24

    .04

    ][][

    ]3[]1[]2[]0[][

  • 9

    Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering

    6. Fast Fourier Transform

    ∑∑

    ∑∑−

    =

    +−

    =++=

    +=

    12/

    0

    )12(12/

    0

    2 ]12[]2[

    ][][][

    N

    r

    krN

    N

    r

    rkN

    nodd

    nkN

    neven

    nkN

    WrxWrx

    WnxWnxkX

    for k = 0, 1,…,N-1

    ∑∑−

    =

    =++=

    12/

    0

    212/

    0

    2 ]12[]2[N

    r

    rkN

    kN

    N

    r

    rkN WrxWWrx

  • 10

    Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering

    6. Fast Fourier Transform

    Length-N/2 DFT of data with even n

    Overhead

    ][][

    ]12[]2[][12/

    02/

    12/

    02/

    kHWkG

    WrxWWrxkX

    kN

    N

    r

    rkN

    kN

    N

    r

    rkN

    +=

    ++= ∑∑−

    =

    =

    • Since

    rkN

    NrkjNrkjrkN

    W

    eeW

    2/

    )2//(2/222

    =

    == −− ππ

    for k = 0, 1,…,N-1

    Length-N/2 DFT of data with odd n

  • 11

    Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering

    6. Fast Fourier Transform

    Example: N = 8

    N/2 = 4 point DFT

    x[0]

    x[2]

    x[4]

    x[6]

    N/2 = 4 point DFT

    x[1]

    x[3]x[5]

    x[7]

    G[0]

    G[1]

    G[2]G[3]

    H[0]

    H[1]

    H[2]H[3]

    X[0]

    X[1]X[2]

    X[3]

    X[4]

    X[5]X[6]

    X[7]W86W85W84

    W83W82W81W80

    W87

  • 12

    Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering

    6. Fast Fourier Transform

    How much it saves?• Assume x[n] has N data and each data is a

    complex number

    ∑−

    ==

    1

    0][][

    N

    n

    nkNWnxkX for k = 0, 1,…,N-1

    • For each k, it needs N complex multiplications and N-1 complex additions

    • In overall, it needs N2 complex multiplications and N(N-1) complex additions

  • 13

    Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering

    6. Fast Fourier Transform

    • FFT converts an N-point DFT to 2 N/2-points DFTs

    ][][][ kHWkGkX kN+= for k = 0, 1,…,N-1

    (N/2)2 complex multiplicationsN/2(N/2-1) complex additions

    N complex multiplications

  • 14

    Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering

    6. Fast Fourier Transform

    262,144x/261,632+ 131,584x/131,072+

    N DFT 1-stage FFT4 16x/12+ 12x/8+

    8 64x/56+ 40x/32+

    16 256x/240+ 144x/128+

    32 1,024x/992+ 544x/512+

    64 4,096x/4,032+ 2,112x/2,048+

    128 16,384x/16,256+ 8,320x/8,192+

    256 65,536x/65,280+ 33,024x/32,768+

    1024 1,048,576x/1,047,552+ 525,312x/524,288+

    512

  • 15

    )(cost)(cost)(cost

    problemoriginaloverheadssubproblem

    <

    +∑

    Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering

    6. Fast Fourier Transform

    • Obviously

    • We can re-apply the same approach to the decomposed N/2 problems

  • 16

    Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering

    6. Fast Fourier Transform

    Example: Apply to G[k] and H[k]x[0]

    x[4]

    x[2]

    x[6]

    x[1]

    x[5]

    x[3]

    x[7]

    X[0]

    X[1]X[2]

    X[3]

    X[4]

    X[5]X[6]

    X[7]W87W86W85W84

    W83W82W81W80

    N/4 = 2 point DFT

    N/4 = 2 point DFT

    N/4 = 2 point DFT

    N/4 = 2 point DFT

    W43

    W42

    W41W40

    W43

    W42W41W40

  • 17

    Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering

    6. Fast Fourier Transform

    • The complexity is further reduced

    • The above decomposition is recursively performed until a length-2 DFT is computed

    • A length-2 DFT can be implemented as a butterflyas follows:

    12

    02

    02

    02

    2

    1

    0

    ]1[]0[]1[

    ]1[]0[]0[

    ][][

    WxWxX

    WxWxX

    WnxkX nkn

    +=

    +=⇒

    = ∑=

    x[0]

    x[1]

    X[0]

    X[1]

    W20 1=

    12/212 −==− πjeW

  • 18

    Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering

    6. Fast Fourier Transform

    x[0]

    x[4]x[2]

    x[6]

    x[1]

    x[5]x[3]

    x[7]

    X[0]

    X[1]X[2]

    X[3]

    X[4]

    X[5]X[6]

    X[7]W87W86W85W84

    W83W82W81W80

    W43

    W42

    W41W40

    W43

    W42W41W40

    -1

    -1

    -1

    -1

  • 19

    Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering

    6. Fast Fourier Transform

    • The complexity can be further reduced. For every butterfly, it can be converted as follows:

    rNW

    )2/( NrNW

    + rNW

    1

    -1

    rNW

    rNW−

    rN

    jrN

    NN

    rN

    NrN WeWWWW −===

    −+ π2/)2/(Since

  • 20

    Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering

    6. Fast Fourier Transform

    -1

    x[0]

    x[4]x[2]

    x[6]

    x[1]

    x[5]x[3]

    x[7]

    X[0]

    X[1]X[2]

    X[3]

    X[4]

    X[5]X[6]

    X[7]W83W82W81W80

    -1

    -1

    -1

    -1

    -1

    -1

    -1

    -1

    -1

    -1-1W41

    W40

    W41W40

    FFTTotal complex multiplication: 5Total complex addition: 24

    DFTTotal complex multiplication: 64Total complex addition: 56

    W20

    W20

    W20

    W20

  • 21

    Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering

    6. Fast Fourier Transform

    Remarks:• FFT of the form above is called decimation-in-time

    (DIT) FFT (or Cooley and Tukey FFT)• In general, the complexity of DIT FFT is

    (N/2)log2N complex multiplications (W0 is considered as multiplication in this expression)

    Nlog2N complex additions

    • DIT FFT requires N to be a power of 2• If N is not a power of 2, need zero padding to let N

    be a power of 2 before FFT • More than a hundred of FFT algorithms after DIT

    FFT for different applications

  • 22

    Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering

    6. Fast Fourier Transform

    Exercise1. Show why the complexity of DIT FFT is given

    by

    (N/2)log2N complex multiplications (W0 is considered as multiplication in this expression)

    Nlog2N complex additions

    2. If N = 256, what are the complexities of DIT FFT and DFT?

  • 23

    Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering

    6. Fast Fourier Transform

    Exercise (cont)

    3. If x[n] has the values {8 7 6 5 4 3 2 1}, use FFT to calculate its spectrum.

  • 24

    Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering

    6. Fast Fourier Transform

    Solution

    1. For a length-N DFT, there will be log2(N) stages. For each stage, there will be N/2 butterflies. For each butterfly, there will 1 complex multiplication and 2 complex additions. Hence the total no. of complex multiplications is N/2log2N. And the number of additions is Nlog2N

  • 25

    Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering

    6. Fast Fourier Transform

    2. If N = 256, DFT requires N2 = 2562 = 65536 complex multiplications and N(N - 1) = 256(255) = 65280 complex additions.

    By using FFT, it requires N/2log2N = 128*8 = 1024 complex multiplications and Nlog2N = 256*8 = 2048 complex additions

  • 26

    Signal Processing Fundamentals – Part ISpectrum Analysis and Filtering

    6. Fast Fourier Transform

    3. If x[n] has the values {8 7 6 5 4 3 2 1}, its spectrum can be calculated using FFT as follows:

    After 1st stage, the output is

    {12 4 8 4 10 4 6 4}

    After 2nd stage, the output is

    {20 4-j4 4 4+j4 16 4-j4 4 4+j4}

    After 3rd stage, the output is

    {36 4-j9.657 4-j4 4-j1.657

    4 4+j1.657 4+j4 4+j9.657}