53
Course Outline

INTRODUCTION TO THE FAST FOURIER TRANSFORM · PDF fileIntroduction Fast Fourier Transforms have revolutionized digital signal processing What is the FFT? yA collection of “tricks”

Embed Size (px)

Citation preview

Page 1: INTRODUCTION TO THE FAST FOURIER TRANSFORM · PDF fileIntroduction Fast Fourier Transforms have revolutionized digital signal processing What is the FFT? yA collection of “tricks”

Course Outline

Page 2: INTRODUCTION TO THE FAST FOURIER TRANSFORM · PDF fileIntroduction Fast Fourier Transforms have revolutionized digital signal processing What is the FFT? yA collection of “tricks”

Course Outline

Page 3: INTRODUCTION TO THE FAST FOURIER TRANSFORM · PDF fileIntroduction Fast Fourier Transforms have revolutionized digital signal processing What is the FFT? yA collection of “tricks”

INTRODUCTION TO THE

FAST FOURIER TRANSFORM

ALGORITHM

Page 4: INTRODUCTION TO THE FAST FOURIER TRANSFORM · PDF fileIntroduction Fast Fourier Transforms have revolutionized digital signal processing What is the FFT? yA collection of “tricks”

Introduction

Fast Fourier Transforms have revolutionized digital signal processing

What is the FFT?A collection of “tricks” that exploit the symmetry of the DFT calculation to make its execution much fasterSpeedup increases with DFT size

Page 5: INTRODUCTION TO THE FAST FOURIER TRANSFORM · PDF fileIntroduction Fast Fourier Transforms have revolutionized digital signal processing What is the FFT? yA collection of “tricks”

Introduction, continued

Some dates:1880 - algorithm first described by Gauss1965 - algorithm rediscovered (not for the first time) by Cooley and Tukey

In 1967, calculation of a 8192-point DFT on the top-of-the line IBM 7094 took ….

30 minutes using conventional techniques5 seconds using FFTs

Page 6: INTRODUCTION TO THE FAST FOURIER TRANSFORM · PDF fileIntroduction Fast Fourier Transforms have revolutionized digital signal processing What is the FFT? yA collection of “tricks”

Measures of computational efficiency

Could considerNumber of additionsNumber of multiplicationsAmount of memory requiredScalability and regularity

For the present discussion we’ll focus most on number of multiplications as a measure of computational complexity

More costly than additions for fixed-point processorsSame cost as additions for floating-point processors, but number of operations is comparable

Page 7: INTRODUCTION TO THE FAST FOURIER TRANSFORM · PDF fileIntroduction Fast Fourier Transforms have revolutionized digital signal processing What is the FFT? yA collection of “tricks”

Computational Cost of Discrete-Time Filtering

Computational Cost of Discrete-Time FilteringConvolution of an N-point input with an M-point unit sample response ….

Direct convolution:

Number of multiplies ≈ MN

y[n] = x[k]h[n− k]k=−∞

∞∑

Page 8: INTRODUCTION TO THE FAST FOURIER TRANSFORM · PDF fileIntroduction Fast Fourier Transforms have revolutionized digital signal processing What is the FFT? yA collection of “tricks”

Computational Cost of Discrete-Time Filtering

Computational Cost of Discrete-Time FilteringConvolution of an N-point input with an M-point unit sample response ….

Using transforms directly:

Computation of N-point DFTs requires multiplys Each convolution requires three DFTs of length N+M-1 plus an additional N+M-1 complex multiplys or

For , for example, the computation is

X[k] = x[n]e− j2πkn / N

n=0

N−1∑

3(N + M −1)2 + (N + M −1)

N >> M O(N2)

N2

Page 9: INTRODUCTION TO THE FAST FOURIER TRANSFORM · PDF fileIntroduction Fast Fourier Transforms have revolutionized digital signal processing What is the FFT? yA collection of “tricks”

The Cooley-Tukey decimation-in-time algorithm

The Cooley-Tukey decimation-in-time algorithm

X[k] =k=0

N−1∑ x[n]WNnk =

k=0

N−1∑ x[n]e− j2πnk / N ; WN = e− j2π / N

X[k] = x[n]WN2k +n even

∑ x[n]WN2k

n odd∑

• Consider the DFT algorithm for an integer power of 2,

• Create separate sums for even and odd values of n:

• Letting for n even and for n odd, we obtain

n = 2r n = 2r +1

X[k] = x[2r]WN2rk +r=0

N / 2( )−1∑ x[2r +1]WN 2r+1( )k

r=0

N /2( )−1∑

Page 10: INTRODUCTION TO THE FAST FOURIER TRANSFORM · PDF fileIntroduction Fast Fourier Transforms have revolutionized digital signal processing What is the FFT? yA collection of “tricks”
Page 11: INTRODUCTION TO THE FAST FOURIER TRANSFORM · PDF fileIntroduction Fast Fourier Transforms have revolutionized digital signal processing What is the FFT? yA collection of “tricks”
Page 12: INTRODUCTION TO THE FAST FOURIER TRANSFORM · PDF fileIntroduction Fast Fourier Transforms have revolutionized digital signal processing What is the FFT? yA collection of “tricks”

The Cooley-Tukey decimation in time algorithm

Splitting indices in time, we have obtained

But andSo …

N/2-point DFT of x[2r] N/2-point DFT of x[2r+1]

X[k] = x[2r]WN2rk +r=0

N / 2( )−1∑ x[2r +1]WN 2r+1( )k

r=0

N /2( )−1∑

WN2 = e− j2π2 / N = e− j2π /(N / 2) = WN / 2 WN

2rkWNk =WN

kWN / 2rk

X[k] =n=0

(N/ 2)−1∑ x[2r]WN /2

rk +WNk

n=0

(N/ 2)−1∑ x[2r +1]WN / 2

rk

Page 13: INTRODUCTION TO THE FAST FOURIER TRANSFORM · PDF fileIntroduction Fast Fourier Transforms have revolutionized digital signal processing What is the FFT? yA collection of “tricks”

Savings so far …

Savings so far …We have split the DFT computation into two halves:

Have we gained anything? Consider the nominal number of multiplications for

Original form produces multiplicationsNew form produces multiplications So we’re already ahead ….. Let’s keep going!!

X[k] =k=0

N−1∑ x[n]WNnk

=n=0

(N/ 2)−1∑ x[2r]WN /2

rk +WNk

n=0

(N/ 2)−1∑ x[2r +1]WN / 2

rk

N = 882 = 64

2(42 ) + 8 = 40

Page 14: INTRODUCTION TO THE FAST FOURIER TRANSFORM · PDF fileIntroduction Fast Fourier Transforms have revolutionized digital signal processing What is the FFT? yA collection of “tricks”

Signal flowgraph representation of 8-point DFT

Signal flowgraph representation of 8-point DFTRecall that the DFT is now of the formThe DFT in (partial) flowgraph notation:

Page 15: INTRODUCTION TO THE FAST FOURIER TRANSFORM · PDF fileIntroduction Fast Fourier Transforms have revolutionized digital signal processing What is the FFT? yA collection of “tricks”

The complete decomposition into 2-point DFTs

Page 16: INTRODUCTION TO THE FAST FOURIER TRANSFORM · PDF fileIntroduction Fast Fourier Transforms have revolutionized digital signal processing What is the FFT? yA collection of “tricks”
Page 17: INTRODUCTION TO THE FAST FOURIER TRANSFORM · PDF fileIntroduction Fast Fourier Transforms have revolutionized digital signal processing What is the FFT? yA collection of “tricks”

The complete decomposition into 2-point DFTs

Page 18: INTRODUCTION TO THE FAST FOURIER TRANSFORM · PDF fileIntroduction Fast Fourier Transforms have revolutionized digital signal processing What is the FFT? yA collection of “tricks”

Now let’s take a closer look at the 2-point DFT

The expression for the 2-point DFT is:

Evaluating for we obtain

which in signal flowgraph notation looks like ...

X[k] =n=0

1∑ x[n]W2

nk =n=0

1∑ x[n]e− j2πnk / 2

X[0] = x[0]+ x[1]

X[1] = x[0] + e− j2π1/ 2x[1] = x[0]− x[1]

This topology is referred to as thebasic butterfly

k = 0,1

Page 19: INTRODUCTION TO THE FAST FOURIER TRANSFORM · PDF fileIntroduction Fast Fourier Transforms have revolutionized digital signal processing What is the FFT? yA collection of “tricks”

The complete 8-point decimation-in-time FFT

Page 20: INTRODUCTION TO THE FAST FOURIER TRANSFORM · PDF fileIntroduction Fast Fourier Transforms have revolutionized digital signal processing What is the FFT? yA collection of “tricks”

Number of multiplys for N-point FFTs

N log2(N)

• Let• (log2(N) columns)(N/2 butterflys/column)(2 mults/butterfly)

or ~ multiplys

N = 2ν where ν = log2(N)

Page 21: INTRODUCTION TO THE FAST FOURIER TRANSFORM · PDF fileIntroduction Fast Fourier Transforms have revolutionized digital signal processing What is the FFT? yA collection of “tricks”

Computational complexity

Page 22: INTRODUCTION TO THE FAST FOURIER TRANSFORM · PDF fileIntroduction Fast Fourier Transforms have revolutionized digital signal processing What is the FFT? yA collection of “tricks”

Additional timesavers: reducing multiplications in the basic butterfly

As we derived it, the basic butterfly is of the form

Since we can reduce computation by 2 by premultiplying by

WNN / 2 = −1

WNr

WNr+N / 2

WNr

1

−1

WNr

Page 23: INTRODUCTION TO THE FAST FOURIER TRANSFORM · PDF fileIntroduction Fast Fourier Transforms have revolutionized digital signal processing What is the FFT? yA collection of “tricks”

Bit reversal of the input

Recall the first stages of the 8-point FFT:

Consider the binary representation of theindices of the input:

0 000 4 1002 0106 1101 0015 1013 0117 111

If these binary indices are time reversed, we get the binary sequence representing

0,1,2,3,4,5,6,7

Hence the indices of the FFTinputs are said to be in bit-reversed order

Page 24: INTRODUCTION TO THE FAST FOURIER TRANSFORM · PDF fileIntroduction Fast Fourier Transforms have revolutionized digital signal processing What is the FFT? yA collection of “tricks”

Some comments on bit reversalIn the implementation of the FFT that we discussed,

the input is bit reversed and the output is developed in natural order

Some other implementations of the FFT have the input in natural order and the output bit reversed

In some situations it is convenient to implement filtering applications by

Use FFTs with input in natural order, output in bit-reversed orderMultiply frequency coefficients together (in bit-reversed order)Use inverse FFTs with input in bit-reversed order, output in natural order

Computing in this fashion means we never have to compute bit reversal explicitly

Page 25: INTRODUCTION TO THE FAST FOURIER TRANSFORM · PDF fileIntroduction Fast Fourier Transforms have revolutionized digital signal processing What is the FFT? yA collection of “tricks”

Decimation in Freq FFT

Page 26: INTRODUCTION TO THE FAST FOURIER TRANSFORM · PDF fileIntroduction Fast Fourier Transforms have revolutionized digital signal processing What is the FFT? yA collection of “tricks”

Alternate FFT structures

We developed the basic decimation-in-time (DIT) FFT structure, but other forms are possible simply by rearranging the branches of the signal flowgraph

Consider the rearranged signal flow diagrams on the following panels …..

Page 27: INTRODUCTION TO THE FAST FOURIER TRANSFORM · PDF fileIntroduction Fast Fourier Transforms have revolutionized digital signal processing What is the FFT? yA collection of “tricks”

Alternate DIT FFT structures (continued)

DIT structure with input bit-reversed, output natural (OSB 9.10):

Page 28: INTRODUCTION TO THE FAST FOURIER TRANSFORM · PDF fileIntroduction Fast Fourier Transforms have revolutionized digital signal processing What is the FFT? yA collection of “tricks”

Alternate DIT FFT structures (continued)

DIT structure with input natural, output bit-reversed (OSB 9.14):

Page 29: INTRODUCTION TO THE FAST FOURIER TRANSFORM · PDF fileIntroduction Fast Fourier Transforms have revolutionized digital signal processing What is the FFT? yA collection of “tricks”

Alternate DIT FFT structures (continued)

DIT structure with both input and output natural (OSB 9.15):

Page 30: INTRODUCTION TO THE FAST FOURIER TRANSFORM · PDF fileIntroduction Fast Fourier Transforms have revolutionized digital signal processing What is the FFT? yA collection of “tricks”

Alternate DIT FFT structures (continued)

DIT structure with same structure for each stage (OSB 9.16):

Page 31: INTRODUCTION TO THE FAST FOURIER TRANSFORM · PDF fileIntroduction Fast Fourier Transforms have revolutionized digital signal processing What is the FFT? yA collection of “tricks”

Comments on alternate FFT structures

A method to avoid bit-reversal in filtering operations is:

Compute forward transform using natural input, bit-reversed output (as in OSB 9.10) Multiply DFT coefficients of input and filter response (both in bit-reversed order)Compute inverse transform of product using bit-reversed input and natural output (as in OSB 9/14)

Latter two topologies (as in OSB 9.15 and 9.16) are now rarely used

Page 32: INTRODUCTION TO THE FAST FOURIER TRANSFORM · PDF fileIntroduction Fast Fourier Transforms have revolutionized digital signal processing What is the FFT? yA collection of “tricks”

Using FFTs for inverse DFTsWe’ve always been talking about forward DFTs in our

discussion about FFTs …. what about the inverse FFT?

One way to modify FFT algorithm for the inverse DFT computation is:

Replace by wherever it appearsMultiply final output by

This method has the disadvantage that it requires modifying the internal code in the FFT subroutine

x[n] = 1Nk=0

N−1∑ X[k]WN

−kn ; X[k] =n=0

N−1∑ x[n]WN

kn

WNk WN

−k

1/N

Page 33: INTRODUCTION TO THE FAST FOURIER TRANSFORM · PDF fileIntroduction Fast Fourier Transforms have revolutionized digital signal processing What is the FFT? yA collection of “tricks”

A better way to modify FFT code for inverse DFTs

Taking the complex conjugate of both sides of the IDFT equation and multiplying by N:

This suggests that we can modify the FFT algorithm for the inverse DFT computation by the following:

Complex conjugate the input DFT coefficientsCompute the forward FFTComplex conjugate the output of the FFT and multiply by 1/N

This method has the advantage that the internal FFT code is undisturbed; it is widely used.

Nx *[n] = 1Nk=0

N−1∑ X *[k ]WN

kn; or x[n] = 1Nk=0

N−1∑ X *[k]WN

kn

*

Page 34: INTRODUCTION TO THE FAST FOURIER TRANSFORM · PDF fileIntroduction Fast Fourier Transforms have revolutionized digital signal processing What is the FFT? yA collection of “tricks”

Principle

Page 35: INTRODUCTION TO THE FAST FOURIER TRANSFORM · PDF fileIntroduction Fast Fourier Transforms have revolutionized digital signal processing What is the FFT? yA collection of “tricks”

Sinusoidal signals

Page 36: INTRODUCTION TO THE FAST FOURIER TRANSFORM · PDF fileIntroduction Fast Fourier Transforms have revolutionized digital signal processing What is the FFT? yA collection of “tricks”
Page 37: INTRODUCTION TO THE FAST FOURIER TRANSFORM · PDF fileIntroduction Fast Fourier Transforms have revolutionized digital signal processing What is the FFT? yA collection of “tricks”
Page 38: INTRODUCTION TO THE FAST FOURIER TRANSFORM · PDF fileIntroduction Fast Fourier Transforms have revolutionized digital signal processing What is the FFT? yA collection of “tricks”

Windowing: resolution and leakage (I)

Page 39: INTRODUCTION TO THE FAST FOURIER TRANSFORM · PDF fileIntroduction Fast Fourier Transforms have revolutionized digital signal processing What is the FFT? yA collection of “tricks”

Windowing: resolution and leakage (II)

Page 40: INTRODUCTION TO THE FAST FOURIER TRANSFORM · PDF fileIntroduction Fast Fourier Transforms have revolutionized digital signal processing What is the FFT? yA collection of “tricks”

Windowing: resolution and leakage (III)

Page 41: INTRODUCTION TO THE FAST FOURIER TRANSFORM · PDF fileIntroduction Fast Fourier Transforms have revolutionized digital signal processing What is the FFT? yA collection of “tricks”

Windowing: resolution and leakage (IV)

Page 42: INTRODUCTION TO THE FAST FOURIER TRANSFORM · PDF fileIntroduction Fast Fourier Transforms have revolutionized digital signal processing What is the FFT? yA collection of “tricks”

Frequencies matched to sampling points

Page 43: INTRODUCTION TO THE FAST FOURIER TRANSFORM · PDF fileIntroduction Fast Fourier Transforms have revolutionized digital signal processing What is the FFT? yA collection of “tricks”

Frequencies matched to sampling pointsN.B: if Hamming window:

Page 44: INTRODUCTION TO THE FAST FOURIER TRANSFORM · PDF fileIntroduction Fast Fourier Transforms have revolutionized digital signal processing What is the FFT? yA collection of “tricks”

Increasing the resolutionNot by increasing L, the DFT size:

Page 45: INTRODUCTION TO THE FAST FOURIER TRANSFORM · PDF fileIntroduction Fast Fourier Transforms have revolutionized digital signal processing What is the FFT? yA collection of “tricks”

Increasing the resolution(II)

Page 46: INTRODUCTION TO THE FAST FOURIER TRANSFORM · PDF fileIntroduction Fast Fourier Transforms have revolutionized digital signal processing What is the FFT? yA collection of “tricks”

Increasing the resolution(III)

Page 47: INTRODUCTION TO THE FAST FOURIER TRANSFORM · PDF fileIntroduction Fast Fourier Transforms have revolutionized digital signal processing What is the FFT? yA collection of “tricks”

Increasing the resolution(IV)

Page 48: INTRODUCTION TO THE FAST FOURIER TRANSFORM · PDF fileIntroduction Fast Fourier Transforms have revolutionized digital signal processing What is the FFT? yA collection of “tricks”

Increasing the resolution(V)

Page 49: INTRODUCTION TO THE FAST FOURIER TRANSFORM · PDF fileIntroduction Fast Fourier Transforms have revolutionized digital signal processing What is the FFT? yA collection of “tricks”

Increasing the resolution(VI)

Page 50: INTRODUCTION TO THE FAST FOURIER TRANSFORM · PDF fileIntroduction Fast Fourier Transforms have revolutionized digital signal processing What is the FFT? yA collection of “tricks”

Effect of window typeUse of other windows can reduce the contamination between peaks:

Page 51: INTRODUCTION TO THE FAST FOURIER TRANSFORM · PDF fileIntroduction Fast Fourier Transforms have revolutionized digital signal processing What is the FFT? yA collection of “tricks”

Effect of window type (II)

Page 52: INTRODUCTION TO THE FAST FOURIER TRANSFORM · PDF fileIntroduction Fast Fourier Transforms have revolutionized digital signal processing What is the FFT? yA collection of “tricks”

Effect of window type (III)

• Kaiser window: prediction formulae for N and β from the values of

– main lobe width

– relative attenuation of side lobes

Page 53: INTRODUCTION TO THE FAST FOURIER TRANSFORM · PDF fileIntroduction Fast Fourier Transforms have revolutionized digital signal processing What is the FFT? yA collection of “tricks”

Summary

We developed the structure of the basic decimation-in-time FFT

Use of the FFT algorithm reduces the number of multiplys required to perform the DFT by a factor of more than 100 for 1024-point DFTs, with the advantage increasing with increasing DFT size