digital signal processingeng.staff.alexu.edu.eg/~alghoniemy/teaching/dsp... · the discrete fourier...

28
Digital Signal Processing [email protected] 10/14/2018 1

Upload: others

Post on 11-Sep-2020

8 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Digital Signal Processingeng.staff.alexu.edu.eg/~alghoniemy/teaching/DSP... · The Discrete Fourier Transform • Direct computation of -point DFT requires 2complex multiplications

Digital Signal Processing

[email protected]

10/14/2018 1

Page 2: Digital Signal Processingeng.staff.alexu.edu.eg/~alghoniemy/teaching/DSP... · The Discrete Fourier Transform • Direct computation of -point DFT requires 2complex multiplications

• Reading:

• Oppenheim:

– Sections: 9.3, 9.4,

• Proakis:

– Sections: 6.1.3, 6.1.4, 6.2.1, 6.2.2

10/14/2018 2

Page 3: Digital Signal Processingeng.staff.alexu.edu.eg/~alghoniemy/teaching/DSP... · The Discrete Fourier Transform • Direct computation of -point DFT requires 2complex multiplications

The Discrete Fourier Transform

• Direct computation of 𝑁-point DFT requires

𝑁2 complex multiplications + 𝑁(𝑁 − 1) complex additions

• The complexity of the DFT is in the order of 𝓞(𝑵𝟐) “too high”

• Memory storage: we need to store 𝑵𝟐 complex coefficients 𝑊𝑁𝑛𝑘

10/14/2018 3

=

−−−−

]1[

:

]2[

]1[

]0[

1

:...:::

...1

...1

1...111

]1[

:

]2[

]1[

]0[

2)1()1(21

)1(242

12

Nx

x

x

x

WWW

WWW

WWW

NX

X

X

X

N

N

N

N

N

N

N

NNN

N

NNN

NNN xFX =

Page 4: Digital Signal Processingeng.staff.alexu.edu.eg/~alghoniemy/teaching/DSP... · The Discrete Fourier Transform • Direct computation of -point DFT requires 2complex multiplications

Factorization of the DFT matrix

• example: rearrange the even-odd columns of the 4-point DFT matrix

• Define the permutation matrix 𝐏𝟒

10/14/2018 4

−−

−−

−−=

jj

jj

11

1111

11

1111

4F

4 4 4

1 1 1 1 1 1 1 1 1

1 1 1 1 1ˆ

1 1 1 1 1 1 1 1 1

1 1 1 1 1

Tj j j j

j j j j

− − − − = = =

− − − −

− − − −

F F P

Page 5: Digital Signal Processingeng.staff.alexu.edu.eg/~alghoniemy/teaching/DSP... · The Discrete Fourier Transform • Direct computation of -point DFT requires 2complex multiplications

Factorization of the DFT matrix

where

10/14/2018 5

4 4 4

1 1 1 1

1 1ˆ

1 1 1 1

1 1

Tj j

j j

− − = =

− −

− −

F F P

2 2 2

4

2 2 2

0

4

2 2 1

4

1 1 1 0 1 1

1 1 0 1 1ˆ

1 1 1 0 1 1

1 1 0 1 1

1 1 1 0 0,

1 1 0 0

j

j

W

j W

− − −

= = −− − −

= = = − −

F D FF

F D F

F D

Page 6: Digital Signal Processingeng.staff.alexu.edu.eg/~alghoniemy/teaching/DSP... · The Discrete Fourier Transform • Direct computation of -point DFT requires 2complex multiplications

Factorization of the DFT matrix

• Note that (why ?)

• The 4-DFT becomes

one 4-point DFT can be computed using two 2-point DFTs10/14/2018 6

2 2 2

4 4

2 2 2

ˆ even even

odd odd

= = −

x xF D FF x F

x xF D F

4 4 4

4

4 4 4

4

( )( )

ˆ

T

T

even

odd

=

=

=

=

I P P

y F x

y F P P x

xy F

x

Page 7: Digital Signal Processingeng.staff.alexu.edu.eg/~alghoniemy/teaching/DSP... · The Discrete Fourier Transform • Direct computation of -point DFT requires 2complex multiplications

• example: consider the 8-point DFT matrix

• Group the even-odd columns

10/14/2018 7

0 0 0 0 0 0 0 0

8 8 8 8 8 8 8 8

0 1 2 3 4 5 6 7

8 8 8 8 8 8 8 8

0 2 4 6 0 2 4 6

8 8 8 8 8 8 8 8

0 3 6 1 4 7 2 5

8 8 8 8 8 8 8 8

8 0 4 0 4 0 4 0 4

8 8 8 8 8 8 8 8

0 5 2 7 4 1 6 3

8 8 8 8 8 8 8 8

0 6 4 2 0 6 4 2

8 8 8 8 8 8 8 8

0 7 6 5 4 3 2 1

8 8 8 8 8 8 8 8

W W W W W W W W

W W W W W W W W

W W W W W W W W

W W W W W W W W

W W W W W W W W

W W W W W W W W

W W W W W W W W

W W W W W W W W

=

F

0 0 0 0 0 0 0 0

8 8 8 8 8 8 8 8

0 2 4 6 1 3 5 7

8 8 8 8 8 8 8 8

0 4 0 4 2 6 2 6

8 8 8 8 8 8 8 8

0 6 4 2 3 1 7 5

8 8 8 8 8 8 8 8

8 0 0 0 0 4 4 4 4

8 8 8 8 8 8 8 8

0 2 4 6 5 7 1 3

8 8 8 8 8 8 8 8

0 4 0 4 6 2 6 2

8 8 8 8 8 8 8 8

0 6

8 8

ˆ

W W W W W W W W

W W W W W W W W

W W W W W W W W

W W W W W W W W

W W W W W W W W

W W W W W W W W

W W W W W W W W

W W W

=F

4 2 7 5 3 1

8 8 8 8 8 8W W W W W

Page 8: Digital Signal Processingeng.staff.alexu.edu.eg/~alghoniemy/teaching/DSP... · The Discrete Fourier Transform • Direct computation of -point DFT requires 2complex multiplications

• Consider the twiddle factor properties

• Define the diagonal matrix 𝐷4

10/14/2018 8

0 4 2 6

8 8 8 81, 1, = , = W W W j W j= = − −

1 1 1 1

8 8 8 8

2 2 2 2

8 8 8 8

3 3 3 3

8 8 8 8

8

1 1 1 1

8 8 8 8

2 2 2 2

8 8 8 8

3 3 3 3

8 8 8 8

0

8

1

8

4 2

8

3

8

1 1 1 1 1 1 1 1

1 1

1 1 1 1

1 1ˆ

1 1 1 1 1 1 1 1

1 1

1 1 1 1

1 1

j j W jW W jW

W W W W

j j W jW W jW

j j W jW W jW

W W W W

j j W jW W jW

W

W

W

W

− − − −

− − − −

− − − − = − − − −

− − − − − − − −

− − − −

=

F

D

Page 9: Digital Signal Processingeng.staff.alexu.edu.eg/~alghoniemy/teaching/DSP... · The Discrete Fourier Transform • Direct computation of -point DFT requires 2complex multiplications

0

8

1

8

2

8

3

8

80

8

1

8

2

8

3

8

1 1 1 1 1 1 1 1

1 1 1 1

1 1 1 1 1 1 1 1

1 1 1 1ˆ

1 1 1 1 1 1 1 1

1 1 1 1

1 1 1 1 1 1 1 1

1 1 1 1

W

j j j jW

W

j j j jW

W

j j j jW

W

j j j jW

− − − − − − − − − − − −

= − − − − − − − − −

− − − −

F

4 4 4

8

4 4 4

ˆ

= −

F D FF

F D F The 8-point DFT can be computed as

one 8-point DFT can be computed as TWO 4-point DFTs

10/14/2018 9

4 4 4

8 8

4 4 4

ˆ even even

odd odd

= = −

x xF D FF x F

x xF D F

Page 10: Digital Signal Processingeng.staff.alexu.edu.eg/~alghoniemy/teaching/DSP... · The Discrete Fourier Transform • Direct computation of -point DFT requires 2complex multiplications

• example: compute the 8-point DFT of the sequence x?

• DFT factorization

• Another DFT factorization

• ends up with a 2-point DFT

10/14/2018 10

8 8

4 4 44 4 4

4 4 44 4 4

/2 2 2

4

/2 2 2

/2 2 2

4

/2 2 2

ˆ even

odd

even even odd

odd even odd

even even

even

even odd

odd even

odd

odd odd

= =

+ = = −−

= −

= −

xy F x F

x

x F x D F xF D Fy

x F x D F xF D F

xF D FF x

xF D F

xF D FF x

xF D F

2 2

1 1 1 0,

1 1 0 j

= = − −

F D

Page 11: Digital Signal Processingeng.staff.alexu.edu.eg/~alghoniemy/teaching/DSP... · The Discrete Fourier Transform • Direct computation of -point DFT requires 2complex multiplications

Decimation in Time FFT (DIT-FFT)

• N-point DFT of the sequence 𝐱 can be computed as TWO N/2-point DFTs

Where

10/14/2018 11

/2 /2 /2

/2 /2 /2

N N N even

N

N N N odd

= −

F D F xF x

F D F x

0

1

/2

/2 1

N

N

N

N

N

W

W

W −

=

D

Page 12: Digital Signal Processingeng.staff.alexu.edu.eg/~alghoniemy/teaching/DSP... · The Discrete Fourier Transform • Direct computation of -point DFT requires 2complex multiplications

8-point DIT-FFT is reduced to two-4 (DIT-FFT)

even sequence

odd sequence

complexity: 𝑵+ Τ𝑵𝟐 𝟐 < 𝑵𝟐10/14/2018

Page 13: Digital Signal Processingeng.staff.alexu.edu.eg/~alghoniemy/teaching/DSP... · The Discrete Fourier Transform • Direct computation of -point DFT requires 2complex multiplications

8-Point radix-2 Decimation-in-Time FFT

Shu

ffled

inp

ut

Ord

ere

d O

utp

ut

10/14/2018

Page 14: Digital Signal Processingeng.staff.alexu.edu.eg/~alghoniemy/teaching/DSP... · The Discrete Fourier Transform • Direct computation of -point DFT requires 2complex multiplications

8-Point radix-2 Decimation-in-Time FFT

Shu

ffled

inp

ut

Ord

ere

d O

utp

ut

10/14/2018

Page 15: Digital Signal Processingeng.staff.alexu.edu.eg/~alghoniemy/teaching/DSP... · The Discrete Fourier Transform • Direct computation of -point DFT requires 2complex multiplications

The basic butterfly for DIT-FFT• Basic butterfly leads to 2-complex multiplications

• If we consider

• We have a butterfly with one complex multiplication

( ) 1 ,1 , 202 −==−=+ N

NN

r

N

Nr

N WWWW

10/14/2018

Page 16: Digital Signal Processingeng.staff.alexu.edu.eg/~alghoniemy/teaching/DSP... · The Discrete Fourier Transform • Direct computation of -point DFT requires 2complex multiplications

8-point radix-2 Decimation-in-Time FFT O

rde

red

Ou

tpu

t

Shu

ffled

inp

ut

10/14/2018

Page 17: Digital Signal Processingeng.staff.alexu.edu.eg/~alghoniemy/teaching/DSP... · The Discrete Fourier Transform • Direct computation of -point DFT requires 2complex multiplications

Bit reversed ordering “shuffling”Gray coding “reflected binary code”

Normal ordering

Binary representation Reversed binary representation

Shuffled sequence

x[0] 000 000 x[0]

x[1] 001 100 x[4]

x[2] 010 010 x[2]

x[3] 011 110 x[6]

x[4] 100 001 x[1]

x[5] 101 101 x[5]

x[6] 110 011 x[3]

x[7] 111 111 x[7]

10/14/2018

Page 18: Digital Signal Processingeng.staff.alexu.edu.eg/~alghoniemy/teaching/DSP... · The Discrete Fourier Transform • Direct computation of -point DFT requires 2complex multiplications

10/14/2018

Complexity of radix-2 FFT

• The Fast Fourier Transform (FFT) reduces the complexity of computing the DFT from 𝓞(𝑵𝟐) to 𝓞(𝑵𝒍𝒐𝒈𝟐𝑵).

• Length 𝑁 = 2𝑀 sequence leads to 𝑀 = 𝑙𝑜𝑔2𝑁-stages FFT.

• Each stage has 𝑁 complex multiplications and 𝑁-additions

• Complexity

≈ 𝓞 𝑵.𝑴 = 𝓞(𝑵𝒍𝒐𝒈𝟐𝑵).

• 𝑁𝑙𝑜𝑔2𝑁 ≪ 𝑁2 for large 𝑁.

• FFT is in-place algorithm

→ no storage required

Page 19: Digital Signal Processingeng.staff.alexu.edu.eg/~alghoniemy/teaching/DSP... · The Discrete Fourier Transform • Direct computation of -point DFT requires 2complex multiplications

High-speed convolution

• The length of 𝑥1[𝑛] is 𝑁1 and the length of 𝑥2[𝑛] is 𝑁2 and we would like to compute 𝑥1 𝑛 ∗ 𝑥2[𝑛]

𝑥1 𝑛 ∗ 𝑥2 𝑛 = 𝐼𝐹𝐹𝑇 𝐹𝐹𝑇(𝑥1 𝑛 ). 𝐹𝐹𝑇(𝑥2[𝑛])

• Choose FFT size as:

𝑁 = 2𝑙𝑜𝑔2 𝑁1+𝑁2−1

where . is the ceiling operator

10/14/2018 19

Page 20: Digital Signal Processingeng.staff.alexu.edu.eg/~alghoniemy/teaching/DSP... · The Discrete Fourier Transform • Direct computation of -point DFT requires 2complex multiplications

8-point Radix-2 Decimation-in-Frequency FFT

10/14/2018 20

Page 21: Digital Signal Processingeng.staff.alexu.edu.eg/~alghoniemy/teaching/DSP... · The Discrete Fourier Transform • Direct computation of -point DFT requires 2complex multiplications

8-point Radix-2 Decimation-in-Frequency FFT

10/14/2018

Page 22: Digital Signal Processingeng.staff.alexu.edu.eg/~alghoniemy/teaching/DSP... · The Discrete Fourier Transform • Direct computation of -point DFT requires 2complex multiplications

Ord

ere

d In

pu

t

Shu

ffled

Ou

tpu

t8-point Radix-2 Decimation-in-Frequency FFT

10/14/2018

Page 23: Digital Signal Processingeng.staff.alexu.edu.eg/~alghoniemy/teaching/DSP... · The Discrete Fourier Transform • Direct computation of -point DFT requires 2complex multiplications

Basic butterfly for DIF-FFT

• Last-stage 2-point FFT

A

A-B

A+B

B

10/14/2018

Page 24: Digital Signal Processingeng.staff.alexu.edu.eg/~alghoniemy/teaching/DSP... · The Discrete Fourier Transform • Direct computation of -point DFT requires 2complex multiplications

radix-𝐫 FFT• 𝑥[𝑛] has length 𝑵 = 𝒓𝑴.

• Number of stages is 𝑴 = 𝒍𝒐𝒈𝒓𝑵

• Decimation-in-time and decimation-in-frequency

– In decimation-in-time structure, the sequence 𝑥[𝑛] is decomposed into its 𝒓 −polyphase subsequences.

– In decimation-in-frequency structure, the sequence 𝑋[𝑘] is decomposed into its 𝒓 −polyphase subsequences

• The basic butterfly has (𝑟 −inputs/ 𝑟 −outputs)

• Bit-reversed-order is in 𝒓-numbering system

– radix-2: use the binary number system {0, 1}

– radix-4: use the quaternary number system {0, 1, 2, 3}

• Most famous is radix-4 FFT

10/14/2018

Page 25: Digital Signal Processingeng.staff.alexu.edu.eg/~alghoniemy/teaching/DSP... · The Discrete Fourier Transform • Direct computation of -point DFT requires 2complex multiplications

Decimation-in-frequency radix-4 FFT

Break the 𝑁 −point DFT into 4-smaller DFTs

from the symmetry properties of the twiddle factor

we have

this is still not 4-DFTs (why?)

10/14/2018

Page 26: Digital Signal Processingeng.staff.alexu.edu.eg/~alghoniemy/teaching/DSP... · The Discrete Fourier Transform • Direct computation of -point DFT requires 2complex multiplications

Decimate by 4 to obtains the 4-polyphase sequences, considering that kn

N

kn

N WW 4

4 =

10/14/2018

Page 27: Digital Signal Processingeng.staff.alexu.edu.eg/~alghoniemy/teaching/DSP... · The Discrete Fourier Transform • Direct computation of -point DFT requires 2complex multiplications

10/14/2018 27

Page 28: Digital Signal Processingeng.staff.alexu.edu.eg/~alghoniemy/teaching/DSP... · The Discrete Fourier Transform • Direct computation of -point DFT requires 2complex multiplications

• Computation of radix-4 output ordering

• Representation is performed in

the quaternary number systemInput index

Quaternary representation

Reversed order

Outputindex

0 00 00 0

1 01 10 4

2 02 20 8

3 03 30 12

4 10 01 1

5 11 11 5

6 12 21 9

7 13 31 13

8 20 02 2

9 21 12 6

10 22 22 10

11 23 32 14

12 30 03 3

13 31 13 7

14 32 23 11

15 33 33 1510/14/2018