dsp u lec10 dft and fft

20
5 l l EC533: Digital Signal Processing Lecture 10 DFT and FFT

Upload: taha25

Post on 05-Dec-2014

3.950 views

Category:

Business


7 download

DESCRIPTION

DFT And FFT

TRANSCRIPT

Page 1: Dsp U   Lec10  DFT And  FFT

5 l lEC533: Digital Signal Processing

Lecture 10 DFT and FFT

Page 2: Dsp U   Lec10  DFT And  FFT

10.1 - Frequency Domain Vs. Time Domain

DTFSCTFS DTFSCTFS

DTFTCTFT

Page 3: Dsp U   Lec10  DFT And  FFT

10.2 - Discrete Fourier Transform (DFT)

A f d h l N l• A finite or periodic sequence has only N unique values, x[n] for S t i l t l d fi d b N di ti t f

Nn p≤0• Spectrum is completely defined by N distinct frequency

samples• Divide 0 2π into N equal steps ω(k) = 2πk/N• Divide 0..2π into N equal steps, ω(k) = 2πk/N• Uniform sampling of DTFT spectrum:

Page 4: Dsp U   Lec10  DFT And  FFT

10.2 – DFT – contd.

Hence,

Where, i.e, 1/Nth of a revolution

Twiddle Factor

Properties of the Twiddle Factor:

WWWW

kN

NkN

kN

NkN

2 −=

=

+

+ j

-11

periodicity

WWWWNN

NN

2

2= -j

1

N=4

Page 5: Dsp U   Lec10  DFT And  FFT

DFT Example

Find the DFT for the 4 points time sequence 1 0 0 1, fs=8KHzat k=0, ∑∑ − ==

330 )()()0( j nTxenTxX ∑∑

==

==00

)()()0(nn

nTxenTxX

)3()2()()0( +++= TxTxTxx21001 =+++=

∑ Ω− =Ω=3

2)()1( nTjenTxX πat k=1,

∑−

=

=Ω=

3 2

0

)()1(

,)()1(

Nnj

n

enTxX

NTenTxX

π

πat k 1,

∑=

=0

)()1(n

NenTxX

ee jj +=+++= −− 11001 43432 ππ

jj +=⎟⎠⎞

⎜⎝⎛−⎟

⎠⎞

⎜⎝⎛+= 1

23sin

23cos1 ππ

Page 6: Dsp U   Lec10  DFT And  FFT

DFT Example – contd.

∑∑=

=

Ω− ==3

0

223

0

2 )()()2(n

Nnj

n

nTj e nTxe nTxXπ

at k=2,

∑=

−=

3

0

4)(

n

Nnje nTxπ

01111001 3434 =−=+=+++= −− ππ jj ee

3 32

∑=

−=

3

0

32)()3(

n

Nnje nTxX

π

29

at k=3,

je j −=+++= − 11001 29π

1,0,1,2)( j jkX −+=

Page 7: Dsp U   Lec10  DFT And  FFT

DFT Example – contd.

1

x(nT)

2

|X(k)|

x x125 250 3750 t(µs) x

12.57 25.14 37.710 kΩ(X 103 rad/s)50.28

√2

+45

φ(k)(⁰)

Phase Angle indeterminate

1,0,,1)( 0 nx =

12.57 25.14

37.710

kΩ(X 103 rad/s)50.28x x

indeterminate

‐45

1,0,1,2)( jjkX −+=

Page 8: Dsp U   Lec10  DFT And  FFT

10.3 - Inverse Discrete Fourier Transform (IDFT)( )

• Ch k• Check

Page 9: Dsp U   Lec10  DFT And  FFT

10.4 - DFT Computational Complexity

The DFT

• (N complex multiplies + N-1 complex adds per point) x N points (k = 0..N-1)N2 complex multiplies and N(N-1) complex additions

has:

N complex multiplies and N(N 1) complex additionswhere

cpx mult: (a+jb)(c+jd) = ac - bd + j(ad+bc)= 4 real mults + 2 real adds

cpx add = 2 real adds

• Total: 4N2 real mults, 4N2-2N real adds

•Looking at DFT Matrix, lots of repeated structure are found;

t iti f ffi i tmeans opportunities for efficient algorithm to be used to reduce the DFT complexity

Page 10: Dsp U   Lec10  DFT And  FFT

10.5 – Fast Fourier Transform (FFT)

• Reduce complexity of DFT from O(N2) to O(N·log2N)Reduce complexity of DFT from O(N ) to O(N log2N)

• Grows more slowly with larger NGrows more slowly with larger N

• Works by decomposing large DFT into several stages of• Works by decomposing large DFT into several stages of smaller DFTs

• Often provided as a highly optimized library

Page 11: Dsp U   Lec10  DFT And  FFT

10.6 - Decimation in Time (DIT) FFT

• Can rearrange DFT formula in 2 halves:Can rearrange DFT formula in 2 halves:

Page 12: Dsp U   Lec10  DFT And  FFT

10.6 - Decimation in Time (DIT) FFT - contd.

• We can evaluate an N-pt DFT as two N/2-pt DFTs (plus a few mults/adds)(plus a few mults/adds)

• But if DFTN• ~ O(N2) then DFTN/2• ~ O((N/2)2) = 1/4 O(N2)

• Total computation ~ 2 * 1/4 O(N2)Total computation 2 1/4 O(N )= 1/2 the computation (+ε) of direct DFT

Page 13: Dsp U   Lec10  DFT And  FFT

10.6.1 - One-Stage DIT Flowgraph

Page 14: Dsp U   Lec10  DFT And  FFT

10.6.2 - Multiple DIT Stages

• If decomposing one DFTN into two smaller DFTN/2’s speeds things up...p

• Why not further divide into DFTN/4’s ?

• i ei.e.

• so have

• Similarly,

Page 15: Dsp U   Lec10  DFT And  FFT

10.6.2 - Multiple DIT Stages – contd.

Two-Stage DIT Flowgraph

Page 16: Dsp U   Lec10  DFT And  FFT

10.6.2 - Multi-stage DIT FFT – contd.

• Can keep doing this until we get down to 2-pt DFTs:

x(0)

x(1)

Page 17: Dsp U   Lec10  DFT And  FFT

10.7 - FFT Implementation Details

• Basic Butterfly at any stage

• Can be simplified to

Page 18: Dsp U   Lec10  DFT And  FFT

10. 8 - 8-pt DIT FFT Flowgraph

000

001

010

W28

0 0

011

100

W2

101110

111

• -1’s absorbed into summation nodes

W8

• disappears0NW

• Twiddle factor step=N/2 j (stage order), j≠1

Page 19: Dsp U   Lec10  DFT And  FFT

10.9 - FFT Complexity

• Total no. of butterflies = NN2log

No f tTotal no. of butterflies

• As each butterfly gives one complex multiplication and 2

2g2 No of stages

As each butterfly gives one complex multiplication and 2 complex addition

• So, FFT has complex multiplications ofSo, FFT has complex multiplications of

DFT ofcase in )(N of instead N)log2N( 2

2 ΟΟ

and complex additions of

DFTfi1))(N(Nfi dN)(Nl ΟΟ DFTofcase in1))-(N(NofinsteadN)(Nlog 2 ΟΟ

Page 20: Dsp U   Lec10  DFT And  FFT

10.10 - Inverse FFT

• Thus

St f l l ti IFFT

•Hence, Use FFT to calculate IFFT

Steps for calculating IFFT:

1. Take the conjugate of the freq. Samples

2. Calculate FFT of these samples

3. Divide the output by N

4 Take the conjugate of the output4. Take the conjugate of the output