chapter 9 computation of the dft

50
1 22/6/7 1 Zhongguo Liu_Biomedical Engineering_Shand ong Univ. Chapter 9 Computation of the Discrete Fourier Transform Zhongguo Liu Biomedical Engineering School of Control Science and Engineering, Shandong University Biomedical Signal processing

Upload: mikeproud

Post on 25-Jan-2015

287 views

Category:

Design


1 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Chapter 9 computation of the dft

123/4/10 1Zhongguo Liu_Biomedical Engineering_Shandong U

niv.

Chapter 9 Computation of the Discrete

Fourier TransformZhongguo Liu

Biomedical Engineering

School of Control Science and Engineering, Shandong University

Biomedical Signal processing

Page 2: Chapter 9 computation of the dft

2

9.0 Introduction

9.1 Efficient Computation of Discrete Fourier Transform

9.2 The Goertzel Algorithm

9.3 decimation-in-time FFT Algorithms

9.4 decimation-in-frequency FFT Algorithms

9.5 practical considerations ( software realization)

Chapter 9 Computation of the Discrete Fourier Transform

Page 3: Chapter 9 computation of the dft

3

9.0 Introduction

1. Compute the N-point DFT and of the two sequence and

kX1 kX 2

nx1 nx2

2. Compute for kXkXkX 213 10 Nk

3. Compute as the inverse DFT of kX 3

nxNnxnx 213

Implement a convolution of two sequences by the following procedure:

Why not convolve the two sequences directly?

There are efficient algorithms called Fast Fourier Transform (FFT) that can be orders of magnitude more efficient than others.

Page 4: Chapter 9 computation of the dft

4

9.1 Efficient Computation of Discrete Fourier Transform

The DFT pair was given as

4

1

0

2 /1[ ]

N

k

j N knx n X k

Ne

1

0

2 /[ ]

N

n

j N knX k x n e

Baseline for computational complexity: Each DFT coefficient requires

N complex multiplications; N-1 complex additions

All N DFT coefficients requireN2 complex multiplications; N(N-1) complex additions

Page 5: Chapter 9 computation of the dft

5

9.1 Efficient Computation of Discrete Fourier Transform

5

Complexity in terms of real operations4N2 real multiplications2N(N-1) real additions (approximate 2N2)

1

0

2 /[ ]

N

n

j N knX k x n e

Page 6: Chapter 9 computation of the dft

6

9.1 Efficient Computation of Discrete Fourier Transform

Most fast methods are based on Periodicity propertiesPeriodicity in n and k; Conjugate symmetry

6

2 / 2 / 2 / 2 /j N k N n j N kN j N k n j N kne e e e 2 / 2 / 2 /j N kn j N k n N j N k N ne e e

Re ]

Page 7: Chapter 9 computation of the dft

7

X[k] can be viewed as the output of a filter to the input x[n]Impulse response of filter: X[k] is the output of the filter at time n=N

9.2 The Goertzel Algorithm

Makes use of the periodicityMultiply DFT equation with this factor

7

2 / 2 1j N Nk j ke e

1

0

1

0

2 / 2 / 2 /[ ] [ ]

N N

r

k

r

j N kN j N r j N k N rX k x r x re e e

k n NX k y n

2 /[ ]

j N knh n u ne

2 /[ ]k

r

j N k n ry n x r u n re

Define

using x[n]=0 for n<0 and n>N-1

Page 8: Chapter 9 computation of the dft

8

9.2 The Goertzel AlgorithmGoertzel

Filter:

8

Computational complexity4N real multiplications; 4N real additionsSlightly less efficient than the direct method

2 /[ ] [ ] [ ]nk

N

j N knh n u n W u ne

1

1

1k kN

H zW z

[ ] [ 0,1 1,...] [ , ,],kk k Ny n y n W x n n N [ 1] 0ky

0,1,., ..,k n NkX k Ny n

nkNWBut it avoids computation and storage of

1

0

[ ]N

knN

n

X k x n W

Page 9: Chapter 9 computation of the dft

9

Second Order Goertzel Filter

Goertzel Filter

9

2 2

1 1

2 21 21 1

1 12

1 2cos1 1

j k j kN N

kj k j kN N

e z e zH z

kz ze z e z N

Multiply both numerator and denominator

1

2

1

1k

j kN

H z

ze

2[ ] [ 2] 2cos [ 1] 0,1,...,[ ],

ky n y n y n x n n N

N

[ ] [ ] [ 1]kk Ny y WN yN N 0,1,, ...,Nk kX

Page 10: Chapter 9 computation of the dft

10

Second Order Goertzel Filter

Complexity for one DFT coefficient ( x(n) is complex sequence). Poles: 2N real multiplications and 4N real additions Zeros: Need to be implement only once:

4 real multiplications and 4 real additionsComplexity for all DFT coefficients

Each pole is used for two DFT coefficients Approximately N2 real multiplications and 2N2 real

additions10

2[ ] [ 2] 2cos [ 1] 0,1,...,[ ],

ky n y n y n x n n N

N

[ ] [ ] [ 1]kk Ny y WN yN N 0,1,, ...,Nk kX

Page 11: Chapter 9 computation of the dft

11

Second Order Goertzel Filter

If do not need to evaluate all N DFT coefficientsGoertzel Algorithm is more efficient than FFT if

less than M DFT coefficients are needed,M < log2N

11

2[ ] [ 2] 2cos [ 1] 0,1,...,[ ],

ky n y n y n x n n N

N

[ ] [ ] [ 1]kk Ny y WN yN N 0,1,, ...,Nk kX

Page 12: Chapter 9 computation of the dft

12

9.3 decimation-in-time FFT Algorithms

Makes use of both periodicity and symmetryConsider special case of N an integer power of 2Separate x[n] into two sequence of length N/2

Even indexed samples in the first sequenceOdd indexed samples in the other sequence

12

1

0

n even n odd

2 /

2 / 2 /

[ ]

[ ] [ ]

N

n

j N kn

j N kn j N kn

X k x n

x n x n

e

e e

Page 13: Chapter 9 computation of the dft

13

9.3 decimation-in-time FFT Algorithms

13

/2 1 /2 1

2 12

r 0 r 0

[2 ] [2 1]N N

r krkN NX k x r W x r W

Substitute variables n=2r for n even and n=2r+1 for odd

G[k] and H[k] are the N/2-point DFT’s of each subsequence

n even n odd

2 / 2 /[ ] [ ]

j N kn j N knX k x n x ne e

kNG k W H k

/2 1 /2 1

/2 /2r 0 r 0

[2 ] [2 1]N N

rk k rkN N Nx r W W x r W

2

/2

2/2

22

N NN

jjNW We e

Page 14: Chapter 9 computation of the dft

14

9.3 decimation-in-time FFT Algorithms

14

G[k] and H[k] are the N/2-point DFT’s of each subsequence

kNG k W H k

/2 1 /2 1

/2 /2r 0 r 0

[2 ] [2 1]N N

rk k rkN N NX k x r W W x r W

/2

22 2/2 rk

N

rrN N

j kj kWe e

2

NG k G k

2

NH k H k

10,1,...,

2

Nk

0,1,...,k N

Page 15: Chapter 9 computation of the dft

15

8-point DFT using decimation-in-time

Figure 9.3

Page 16: Chapter 9 computation of the dft

16

computational complexityTwo N/2-point DFTs

2(N/2)2 complex multiplications

2(N/2)2 complex additions

Combining the DFT outputs

N complex multiplications

N complex additions

Total complexity

N2/2+N complex multiplications

N2/2+N complex additions

More efficient than direct DFT

16

Page 17: Chapter 9 computation of the dft

17

9.3 decimation-in-time FFT Algorithms

Repeat same process , Divide N/2-point DFTs into Two N/4-point DFTsCombine outputs

17

N=8

Page 18: Chapter 9 computation of the dft

18

9.3 decimation-in-time FFT Algorithms

After two steps of decimation in time

18

Repeat until we’re left with two-point DFT’s

Page 19: Chapter 9 computation of the dft

19

9.3 decimation-in-time FFT Algorithms

flow graph for 8-point decimation in time

19

Complexity:Nlog2N complex multiplications and additions

Page 20: Chapter 9 computation of the dft

20

Butterfly Computation

Flow graph constitutes of butterflies

20

We can implement each butterfly with one multiplication

Final complexity for decimation-in-time FFT(N/2)log2N complex multiplications and additions

Page 21: Chapter 9 computation of the dft

21

9.3 decimation-in-time FFT Algorithms

Final flow graph for 8-point decimation in time

21

Complexity:(Nlog2N)/2 complex multiplications and Nlog2N additions

Page 22: Chapter 9 computation of the dft

22

9.3.1 In-Place Computation同址运算

Decimation-in-time flow graphs require two sets of registersInput and output for each stage

22

0

0

0

0

0

0

0

0

0 0

1 4

2 2

3 6

4 1

5 5

6 3

7 7

X x

X x

X x

X x

X x

X x

X x

X x

0

4

2

6

1

5

3

7

x

x

x

x

x

x

x

x

0

1

2

3

4

5

6

7

X

X

X

X

X

X

X

X

2

2

2

2

2

2

2

2

0

1

2

3

4

5

6

7

X

X

X

X

X

X

X

X

Page 23: Chapter 9 computation of the dft

23

9.3.1 In-Place Computation同址运算

Note the arrangement of the input indicesBit reversed indexing(码位倒置)

23

0 0

0 0

0 0

0 0

0 0

0 0

0 0

0 0

0 0 000 000

1 4 001 100

2 2 010 010

3 6 011 110

4 1 100 001

5 5 101 101

6 3 110 011

7 7 111 111

X x X x

X x X x

X x X x

X x X x

X x X x

X x X x

X x X x

X x X x

0

4

2

6

1

5

3

7

x

x

x

x

x

x

x

x

0

1

2

3

4

5

6

7

X

X

X

X

X

X

X

X

Page 24: Chapter 9 computation of the dft

24

Figure 9.13

cause of bit-reversed order

binary coding for position :000

001

010

011

100

101

110

111

MN 2

must padding 0 to

Page 25: Chapter 9 computation of the dft

25

9.3.2 Alternative forms

Note the arrangement of the input indicesBit reversed indexing(码位倒置)

25

0 0

0 0

0 0

0 0

0 0

0 0

0 0

0 0

0 0 000 000

1 4 001 100

2 2 010 010

3 6 011 110

4 1 100 001

5 5 101 101

6 3 110 011

7 7 111 111

X x X x

X x X x

X x X x

X x X x

X x X x

X x X x

X x X x

X x X x

0

4

2

6

1

5

3

7

x

x

x

x

x

x

x

x

0

1

2

3

4

5

6

7

X

X

X

X

X

X

X

X

Page 26: Chapter 9 computation of the dft

26

Figure 9.14

9.3.2 Alternative forms

strongpoint : in-place computations

shortcoming : non-sequential access of data

Page 27: Chapter 9 computation of the dft

27

Figure 9.15

shortcoming : not in-place computation

non-sequential access of data

Page 28: Chapter 9 computation of the dft

28

Figure 9.16

shortcoming : not in-place computation

strongpoint: sequential access of data

Page 29: Chapter 9 computation of the dft

29

9.3 decimation-in-time FFT Algorithms

29

/2 1 /2 1

2 12

r 0 r 0

[2 ] [2 1]N N

r krkN NX k x r W x r W

Substitute variables n=2r for n even and n=2r+1 for odd

G[k] and H[k] are the N/2-point DFT’s of each subsequence

n even n odd

2 / 2 /[ ] [ ]

j N kn j N knX k x n x ne e

kNG k W H k

/2 1 /2 1

/2 /2r 0 r 0

[2 ] [2 1]N N

rk k rkN N Nx r W W x r W

2

/2

2/2

22

N NN

jjNW We e

Review

Page 30: Chapter 9 computation of the dft

30

9.3.1 In-Place Computation同址运算Bit reversed indexing(码位倒置)

30

0

0

0

0

0

0

0

0

000 000

001 100

010 010

011 110

100 001

101 101

110 011

111 111

X x

X x

X x

X x

X x

X x

X x

X x

0

4

2

6

1

5

3

7

x

x

x

x

x

x

x

x

0

1

2

3

4

5

6

7

X

X

X

X

X

X

X

X

Page 31: Chapter 9 computation of the dft

31

Figure 9.14

9.3.2 Alternative forms

strongpoint : in-place computations

shortcoming : non-sequential access of data

Page 32: Chapter 9 computation of the dft

32

9.4 Decimation-In-Frequency FFT Algorithm

The DFT equation

32

1

0

[ ]N

nkN

n

X k x n W

1 / 2 1 1

2 2 2

0 0 / 2

2 [ ] [ ] [ ]N N N

n r n r n rN N N

n n n N

X r x n W x n W x n W

/2 1

/20

[ ] [ / 2]N

nrN

n

x n x n N W

Split the DFT equation into even and odd frequency indexes

Substitute variables

/2 1 /2 1

/2 22

0 0

[ ] [ / 2]N N

n N rn rN N

n n

x n W x n N W

/2 1

0/2( )

Nrn

nNg n W

Page 33: Chapter 9 computation of the dft

33

9.4 Decimation-In-Frequency FFT Algorithm

The DFT equation

33

1

0

[ ]N

nkN

n

X k x n W

1 /2 1 1

(2 1) (2 1) (2 1)

0 0 /2

2 1 [ ] [ ] [ ]N N N

n r n r n rN N N

n n n N

X r x n W x n W x n W

/2 1

(2 1)

0

[ ] [ / 2]N

n rN

n

x n x n N W

/2 1 /2 1

/2 (2 1)(2 1)

0 0

[ ] [ / 2]N N

n N rn rN N

n n

x n W x n N W

(2 1) /22 1N

r Nr NN N NW W W

2

/22 1n r rn n rn n

N NN N NW W W W W

/

2

2 1

0/[ ] [ / 2]

Nn rnN

nNx n x n N W W

/2

/2 1

0

( )N

n rN N

n

n

h n W W

Page 34: Chapter 9 computation of the dft

34

decimation-in-frequency decomposition of an N-point DFT to N/2-point DFT

34

/2 1

0/22 [ ] [ / 2]

N

n

nrNX r x n x n N W

/2 1

0/22 1 [ ] [ / 2]

Nn rnN

nNX r x n x n N W W

/2

/2 1

0

( )N

n rN N

n

n

h n W W

/2 1

0/2( )

Nrn

nNg n W

Page 35: Chapter 9 computation of the dft

35

/4

/4 12

0

( )N

n sN N

n

n

q n W W

/

2

0/4

4 1

2*(2 1) [ ( ) ( / 4)] N N

Nn sn

n

X s g n g n N W W

decimation-in-frequency decomposition of an 8-point DFT to four 2-point DFT

35

/4 1

0/4( )

Nsn

nNp n W

/

0/4

4 1

2*2 [ ( ) ( / 4)]N

sn

nNX s g n g n N W

Page 36: Chapter 9 computation of the dft

36

2-point DFT

36

081 1( ) ( ) ( )v v vX q X p X q W 8when N

1 1( ) ( ) ( )v v vX p X p X q

Page 37: Chapter 9 computation of the dft

37

/2 1

0/22 [ ] [ / 2]

N

n

nrNX r x n x n N W

/2 1

0/2( )

Nrn

nNg n W

/4 1 /2 1

2 2

0 /4

/4 1 /4 12 2 ( /4)

0 0

/4 1 /4

/2 /2

/2 /2

/4 /4

/

1

0 0

04

/4 1

2*2 ( ) ( )

( ) ( / 4)

( ) ( / 4)

[ ( ) ( / 4)]

N Nsn sn

n n N

N Nsn s n N

n n

N Nsn sn

N N

N N

N N

N

n n

Nsn

n

X s g n W g n W

g n W g n N W

g n W g n N W

g n g n N W

/4 1

0/4( )

Nsn

nNp n W

Page 38: Chapter 9 computation of the dft

38

/2 1

0/22 [ ] [ / 2]

N

n

nrNX r x n x n N W

/2 1

0/2( )

Nrn

nNg n W

/2 1

(2 1)

0

/4 1 /2 1(2 1)

/2

/2 /2

/4 /2

(2 1)

0 /

/2

/4 /4 /

4

/4 1 /4 1(2 1)( /4)

0 0

/4 12 2 (2 1)

02

2*(2 1) ( )

( ) ( )

( ) ( / 4)

( ) ( / 4)

Ns n

n

N Ns n s n

n n N

N

N

N N

N N N

N N N N

Nsn n s n N

n n

Nsn n s

Nn n s N

n

X s g n W

g n W g n W

g n W W g n N W

g n W W g n N W W W

/4 1

/4

0

/4 12

0/4[ ( ) ( / 4)] N N

N

n

Nn sn

n

g n g n N W W

/2 /2

(2 1) /4 /2 /4/2 1s N sN N

N N NW W W

/4

/4 12

0

( )N

n sN N

n

n

q n W W

Page 39: Chapter 9 computation of the dft

39

/4

/4 1

0

2*2 ( )N

sn

nNX s p n W

/4

/4

/4 12

0

/8 1 /4 1

/2

/4

2

0 8

2*2*2 ( )

( ) ( )

Ntn

n

N Nt

N

n tn

n n NN N

X t p n W

p n W p n W

/8 1 /8 1

2 2 ( /8)

04

0/4 /( ) ( / 8)

N Ntn t n N

Nn n

Np n W p n N W

/8 1

0/8[ ( ) ( / 8)]

Ntn

nNp n p n N W

( ) ( 1)p n p n 8when N

Page 40: Chapter 9 computation of the dft

40

/4

/4 1

0

2*2 ( )N

sn

nNX s p n W

/4

/4

/4 1(2 1)

0

/8 1 /4 1(2 1) (2 1)

04

//

8

2*2*(2 1) ( )

( ) ( )

Nt n

n

N Nt n t n

N

Nn n N

N

X t p n W

p n W p n W

/8 1 /8 1

(2 1) (2 1)( /8)

0 0/4 /4( ) ( / 8)

N Nt n t n N

nN

nNp n W p n N W

/8 1

0

4/8[ ( ) ( / 8)] N

Ntn n

Nn

p n p n N W W

0

8[ ( ) ( 1)]p n p n W 8when N

/8 1 /8 12 2 (2

/4 /4 /4 /4 /41) /8

0 0

( ) ( / 8)N N

tn nN N N

tn n t N

n nN Np n W W p n N W W W

/4 /4(2 1) /8 /4 /8

/4 1t N tN NN N NW W W

Page 41: Chapter 9 computation of the dft

41

Final flow graph for 8-point DFT decimation in frequency

41

Page 42: Chapter 9 computation of the dft

42

9.4.1 In-Place Computation同址运算

42

DIF FFT

DIT FFT

Page 43: Chapter 9 computation of the dft

43

9.4.1 In-Place Computation同址运算

43

DIF FFT

DIT FFT

Page 44: Chapter 9 computation of the dft

44

9.4.2 Alternative forms

44

decimation-in-time Butterfly Computation

decimation-in-frequecy Butterfly Computation

Page 45: Chapter 9 computation of the dft

45

The DIF FFT is the transpose of the DIT FFT

45

DIF FFT

DIT FFT

Page 46: Chapter 9 computation of the dft

46

9.4.2 Alternative forms

DIF FFT

DIT FFT

Page 47: Chapter 9 computation of the dft

47

9.4.2 Alternative forms

DIF FFT

DIT FFT

Page 48: Chapter 9 computation of the dft

48

Figure 9.24 erratum

0

4

2

6

1

5

3

7

x

x

x

x

x

x

x

x

Page 49: Chapter 9 computation of the dft

49

9.4.2 Alternative forms

DIF FFT

DIT FFT

Page 50: Chapter 9 computation of the dft

50

23/4/1050Zhongguo Liu_Biomedical Engineering_Shandong U

niv.

Chapter 9 HW9.1, 9.2, 9.3,

上一页 下一页返 回