review of discrete fourier transformtwins.ee.nctu.edu.tw/courses/dsp_07/chap8-ref.pdfusing circular...

46
[email protected] 1 Review of Discrete Fourier Transform

Upload: others

Post on 30-Nov-2020

26 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Review of Discrete Fourier Transformtwins.ee.nctu.edu.tw/courses/dsp_07/Chap8-ref.pdfUsing Circular Convolution to Implement Linear Convolution • Consider two sequences x 1[n] of

[email protected] 1

Review of Discrete Fourier Transform

Page 2: Review of Discrete Fourier Transformtwins.ee.nctu.edu.tw/courses/dsp_07/Chap8-ref.pdfUsing Circular Convolution to Implement Linear Convolution • Consider two sequences x 1[n] of

[email protected] 2

4 Forms of Fourier Transform

“Sampled” frequency

Page 3: Review of Discrete Fourier Transformtwins.ee.nctu.edu.tw/courses/dsp_07/Chap8-ref.pdfUsing Circular Convolution to Implement Linear Convolution • Consider two sequences x 1[n] of

[email protected] 3

Continuous-Time and Continuous-Frequency

ContinuousAperiodic

ContinuousAperiodic

Page 4: Review of Discrete Fourier Transformtwins.ee.nctu.edu.tw/courses/dsp_07/Chap8-ref.pdfUsing Circular Convolution to Implement Linear Convolution • Consider two sequences x 1[n] of

[email protected] 4

Continuous-Time and Discrete-Frequency

Fourier series of periodic continuous signals

PeriodicContinuous

Discrete Aperiodic

Page 5: Review of Discrete Fourier Transformtwins.ee.nctu.edu.tw/courses/dsp_07/Chap8-ref.pdfUsing Circular Convolution to Implement Linear Convolution • Consider two sequences x 1[n] of

[email protected] 5

Discrete-Time and Continuous-Frequency

Fourier transform of aperiodic discrete signals

DiscreteAperiodic Continuous

Periodic

Page 6: Review of Discrete Fourier Transformtwins.ee.nctu.edu.tw/courses/dsp_07/Chap8-ref.pdfUsing Circular Convolution to Implement Linear Convolution • Consider two sequences x 1[n] of

[email protected] 6

Discrete Fourier Transform

• DFT is identical to samples of Fourier transforms• In DSP applications, we are able to store only a finite number of samples• we are able to compute the spectrum only at specific discrete values of ω

Page 7: Review of Discrete Fourier Transformtwins.ee.nctu.edu.tw/courses/dsp_07/Chap8-ref.pdfUsing Circular Convolution to Implement Linear Convolution • Consider two sequences x 1[n] of

[email protected] 7

Discrete Fourier Transform• Discrete Fourier transform (DFT) pairs

knN

jknN

N

k

knN

N

n

knN

eW

NnWkXN

nx

NkWnxkX

π2

1

0

1

0

where

,1,,1,0 ,][1][

1,,1,0 ,][][

−−

=

=

=

−==

−==

K

K

• DFT/IDFT can be implemented by using the same hardware• It requires N2 complex multiplications and N(N-1) complex additions

N complex multiplicationsN-1 complex additions

Page 8: Review of Discrete Fourier Transformtwins.ee.nctu.edu.tw/courses/dsp_07/Chap8-ref.pdfUsing Circular Convolution to Implement Linear Convolution • Consider two sequences x 1[n] of

[email protected] 8

More About DFT• Properties of Discrete Fourier

Transform• Linear Convolution and Discrete

Fourier Transform• Discrete Cosine Transform

Page 9: Review of Discrete Fourier Transformtwins.ee.nctu.edu.tw/courses/dsp_07/Chap8-ref.pdfUsing Circular Convolution to Implement Linear Convolution • Consider two sequences x 1[n] of

[email protected] 9

Periodic Sequence• Consider a periodic sequence of period N• The sequence can be represented by Fourier

series

• The Fourier series for any discrete-time signal with period N requires only N harmonically related complex exponentials.

][~ nx

( )∑=k

knNjekXN

nx /2][~1][~ π

( )( ) ( ) ][][ /2/2 neeene kknNjnlNkNj

lNk === ++

ππQ

( )∑−

=

=∴1

0

/2][~1][~ N

k

knNjekXN

nx π

Page 10: Review of Discrete Fourier Transformtwins.ee.nctu.edu.tw/courses/dsp_07/Chap8-ref.pdfUsing Circular Convolution to Implement Linear Convolution • Consider two sequences x 1[n] of

[email protected] 10

Apply the Orthogonality property, we have

Interchange the order of summation

The coefficients are also periodic with period N

Page 11: Review of Discrete Fourier Transformtwins.ee.nctu.edu.tw/courses/dsp_07/Chap8-ref.pdfUsing Circular Convolution to Implement Linear Convolution • Consider two sequences x 1[n] of

[email protected] 11

DFS Representation of a Periodic Sequence

Synthesis equation Analysis equation

[ ] [ ] NnxkX period of sequence periodic are ~ and ~

Page 12: Review of Discrete Fourier Transformtwins.ee.nctu.edu.tw/courses/dsp_07/Chap8-ref.pdfUsing Circular Convolution to Implement Linear Convolution • Consider two sequences x 1[n] of

[email protected] 12

Physical Significance

Let

One period

Then

Page 13: Review of Discrete Fourier Transformtwins.ee.nctu.edu.tw/courses/dsp_07/Chap8-ref.pdfUsing Circular Convolution to Implement Linear Convolution • Consider two sequences x 1[n] of

[email protected] 13

vs][~ kX )( ωjeX

Example

Page 14: Review of Discrete Fourier Transformtwins.ee.nctu.edu.tw/courses/dsp_07/Chap8-ref.pdfUsing Circular Convolution to Implement Linear Convolution • Consider two sequences x 1[n] of

[email protected] 14

Sampling the Fourier Transform

Nπ2

unit circle

Then

or

The sampling sequence is periodic with period N

Suppose exists

Since

Page 15: Review of Discrete Fourier Transformtwins.ee.nctu.edu.tw/courses/dsp_07/Chap8-ref.pdfUsing Circular Convolution to Implement Linear Convolution • Consider two sequences x 1[n] of

[email protected] 15

vs][~ nx ][nx

By adding together an infinite number of shifted replicas of x[n]

Page 16: Review of Discrete Fourier Transformtwins.ee.nctu.edu.tw/courses/dsp_07/Chap8-ref.pdfUsing Circular Convolution to Implement Linear Convolution • Consider two sequences x 1[n] of

[email protected] 16

Aliasing Problem 1• x[n] is infinite-length sequence

][~ nx

x

Page 17: Review of Discrete Fourier Transformtwins.ee.nctu.edu.tw/courses/dsp_07/Chap8-ref.pdfUsing Circular Convolution to Implement Linear Convolution • Consider two sequences x 1[n] of

[email protected] 17

Aliasing Problem 2• If x[n] is finite-length sequence, 0≤n≤M-1• Consider the case N<M

][][~ nxnx ≠

][~ nx

Page 18: Review of Discrete Fourier Transformtwins.ee.nctu.edu.tw/courses/dsp_07/Chap8-ref.pdfUsing Circular Convolution to Implement Linear Convolution • Consider two sequences x 1[n] of

[email protected] 18

Concluding Remarks

][~ nx

The case N≥M

or

Page 19: Review of Discrete Fourier Transformtwins.ee.nctu.edu.tw/courses/dsp_07/Chap8-ref.pdfUsing Circular Convolution to Implement Linear Convolution • Consider two sequences x 1[n] of

[email protected] 19

Property of DFT• Linearity

if

then

of length N1

of length N2

of length N3=max[N1 , N2]

Page 20: Review of Discrete Fourier Transformtwins.ee.nctu.edu.tw/courses/dsp_07/Chap8-ref.pdfUsing Circular Convolution to Implement Linear Convolution • Consider two sequences x 1[n] of

[email protected] 20

Circular Shift of a Sequence

][]2[~

]2[~

][~

][

nRnx

nx

nx

nx

N−

N=15

A rotation ofthe cylinder

Page 21: Review of Discrete Fourier Transformtwins.ee.nctu.edu.tw/courses/dsp_07/Chap8-ref.pdfUsing Circular Convolution to Implement Linear Convolution • Consider two sequences x 1[n] of

[email protected] 21

Circular Shift of a Sequence

][]13[~

]13[~

][~

][

15 nRnx

nx

nx

nx

+

+

N=15

A rotation ofthe cylinder

Page 22: Review of Discrete Fourier Transformtwins.ee.nctu.edu.tw/courses/dsp_07/Chap8-ref.pdfUsing Circular Convolution to Implement Linear Convolution • Consider two sequences x 1[n] of

[email protected] 22

0 ≤ n ≤ N-1

Property of DFT• Circular Shift

if of length N

then

A rotation of the sequence in the interval

m

that is

0 ≤ l ≤ N-1On the other hand

Page 23: Review of Discrete Fourier Transformtwins.ee.nctu.edu.tw/courses/dsp_07/Chap8-ref.pdfUsing Circular Convolution to Implement Linear Convolution • Consider two sequences x 1[n] of

[email protected] 23

Other Properties of DFT• Duality

– 8.6.3

• Symmetry– 8.6.4

Page 24: Review of Discrete Fourier Transformtwins.ee.nctu.edu.tw/courses/dsp_07/Chap8-ref.pdfUsing Circular Convolution to Implement Linear Convolution • Consider two sequences x 1[n] of

[email protected] 24

More About DFT• Properties of Discrete Fourier

Transform• Linear Convolution and Discrete

Fourier Transform• Discrete Cosine Transform

Page 25: Review of Discrete Fourier Transformtwins.ee.nctu.edu.tw/courses/dsp_07/Chap8-ref.pdfUsing Circular Convolution to Implement Linear Convolution • Consider two sequences x 1[n] of

[email protected] 25

Review of Convolution

• Given two sequences:– Data sequence xi, 0 ≤ i≤ N-1, of length N– Filter sequence hi, 0 ≤ i≤ L-1, of length L

• Linear convolution

• Direct computation, for example 2-by-2 convolution2,,1,0 , −+=∗=∗= NLixhhxy iiiii K

NL multiplications

hx sL-point sequence N-point

sequence

(L+N-1)-point sequence

⎥⎦

⎤⎢⎣

⎥⎥⎥

⎢⎢⎢

⎡=

⎥⎥⎥

⎢⎢⎢

1

0

1

01

0

2

1

0

0

0

xx

hhh

h

sss require 4 multiplications

and 1 addition

Page 26: Review of Discrete Fourier Transformtwins.ee.nctu.edu.tw/courses/dsp_07/Chap8-ref.pdfUsing Circular Convolution to Implement Linear Convolution • Consider two sequences x 1[n] of

[email protected] 26

Linear Convolution

Linear Shift

Linear Shift

Linear Shift

Page 27: Review of Discrete Fourier Transformtwins.ee.nctu.edu.tw/courses/dsp_07/Chap8-ref.pdfUsing Circular Convolution to Implement Linear Convolution • Consider two sequences x 1[n] of

[email protected] 27

Linear Shift vs Circular Shift

Conventional shift(linear shift)

Page 28: Review of Discrete Fourier Transformtwins.ee.nctu.edu.tw/courses/dsp_07/Chap8-ref.pdfUsing Circular Convolution to Implement Linear Convolution • Consider two sequences x 1[n] of

[email protected] 28

Circular Shift Example

Page 29: Review of Discrete Fourier Transformtwins.ee.nctu.edu.tw/courses/dsp_07/Chap8-ref.pdfUsing Circular Convolution to Implement Linear Convolution • Consider two sequences x 1[n] of

[email protected] 29

Periodic/Circular Convolution

Circular Shift

Page 30: Review of Discrete Fourier Transformtwins.ee.nctu.edu.tw/courses/dsp_07/Chap8-ref.pdfUsing Circular Convolution to Implement Linear Convolution • Consider two sequences x 1[n] of

[email protected] 30

Circular Convolution Definition• Suppose two finite-length duration sequences:

x1[n] and x2[n] of length N

x3[n] is also a finite-length duration sequences of length N

Page 31: Review of Discrete Fourier Transformtwins.ee.nctu.edu.tw/courses/dsp_07/Chap8-ref.pdfUsing Circular Convolution to Implement Linear Convolution • Consider two sequences x 1[n] of

[email protected] 31

Computation for Circular Convolution

1. To period the two sequence with period N (large enough)

2. To compute the periodic convolution of the two periodic sequences

3. To get out the duration sequence between [0, N-1]

Page 32: Review of Discrete Fourier Transformtwins.ee.nctu.edu.tw/courses/dsp_07/Chap8-ref.pdfUsing Circular Convolution to Implement Linear Convolution • Consider two sequences x 1[n] of

[email protected] 32

Example

Step 1

Step 2

Step 3

Page 33: Review of Discrete Fourier Transformtwins.ee.nctu.edu.tw/courses/dsp_07/Chap8-ref.pdfUsing Circular Convolution to Implement Linear Convolution • Consider two sequences x 1[n] of

[email protected] 33

Circular Convolution Property• Usually, we use the following notation to

represent the circular convolution of length N

• Circular convolution property

Page 34: Review of Discrete Fourier Transformtwins.ee.nctu.edu.tw/courses/dsp_07/Chap8-ref.pdfUsing Circular Convolution to Implement Linear Convolution • Consider two sequences x 1[n] of

[email protected] 34

Circular Convolution Implementation

• Direct Implementation

hx sN-point sequence N-point

sequence

N-point sequence

4×4 cyclic convolution

16 multiplications12 additions

Circular Convolution

~ O(N2)

Page 35: Review of Discrete Fourier Transformtwins.ee.nctu.edu.tw/courses/dsp_07/Chap8-ref.pdfUsing Circular Convolution to Implement Linear Convolution • Consider two sequences x 1[n] of

[email protected] 35

Using Circular Convolution to Implement Linear Convolution

• Consider two sequences x1[n] of length L and x2[n] of length P, respectively

• The linear convolution x3=x1[n] ∗x2[n]

• Choose N, such that N≥L+P-1, then

a sequence of length L+P-1The same concept related to Winogrand Algorithm

Page 36: Review of Discrete Fourier Transformtwins.ee.nctu.edu.tw/courses/dsp_07/Chap8-ref.pdfUsing Circular Convolution to Implement Linear Convolution • Consider two sequences x 1[n] of

[email protected] 36

Linear Convolution

Page 37: Review of Discrete Fourier Transformtwins.ee.nctu.edu.tw/courses/dsp_07/Chap8-ref.pdfUsing Circular Convolution to Implement Linear Convolution • Consider two sequences x 1[n] of

[email protected] 37

Circular Convolution with N=L+P-1

Time aliasing in the circular convolution of two finite-length sequence can be avoided if N ≥ L+P-1

Page 38: Review of Discrete Fourier Transformtwins.ee.nctu.edu.tw/courses/dsp_07/Chap8-ref.pdfUsing Circular Convolution to Implement Linear Convolution • Consider two sequences x 1[n] of

[email protected] 38

Concluding Remarks• The convolution of two finite-length sequences can be

interpreted by circular convolution with large enough length• Circular convolution can be implemented by DFT/FFT

• However, in real applications….– For an FIR system, the input sequence is of indefinite duration– To store the entire input signal requires ?

• A large delay in processing• An indefinite memory

– Block convolution

Page 39: Review of Discrete Fourier Transformtwins.ee.nctu.edu.tw/courses/dsp_07/Chap8-ref.pdfUsing Circular Convolution to Implement Linear Convolution • Consider two sequences x 1[n] of

[email protected] 39

Block Convolution• Step1: To segment a sequence into

sections of length L• Step2: Each section is convolved with the

finite-length impulse response of length P by using DFT/FFT of length N=L+P-1

• Step3: The filtered sections are fitted together in an appropriate way

• Overlap-add method• Overlap-save method

Page 40: Review of Discrete Fourier Transformtwins.ee.nctu.edu.tw/courses/dsp_07/Chap8-ref.pdfUsing Circular Convolution to Implement Linear Convolution • Consider two sequences x 1[n] of

[email protected] 40

Overlap-Add Methodhx y

x[n]

h[n]

Step1 Zero padding

Zero padding

Zero padding

Page 41: Review of Discrete Fourier Transformtwins.ee.nctu.edu.tw/courses/dsp_07/Chap8-ref.pdfUsing Circular Convolution to Implement Linear Convolution • Consider two sequences x 1[n] of

[email protected] 41

Step2&

Step3

Time shift

][ ][][][][ N nhnxnhnxny rrr =∗=with L+P-1 length

Time shift

Page 42: Review of Discrete Fourier Transformtwins.ee.nctu.edu.tw/courses/dsp_07/Chap8-ref.pdfUsing Circular Convolution to Implement Linear Convolution • Consider two sequences x 1[n] of

[email protected] 42

Overlap-Save Method• Suppose L > P. • Consider an L-point circular convolution of a P-point impulse

response h[n] with an L-point input sequence xr[n]– Due to aliasing problem, the first (P-1)-point of the result is

incorrect– the remaining points [P, L-1] are identical to those that would

be obtained by linear convolution

• Step1: To segment a sequence into sections of length L such that each section overlaps the preceding section by (P-1) points

• Step2: Each section is convolved with the finite-length impulse response of length P by using DFT/FFT of length L

• Step3: The first (P-1)-point of each filtered sequence must be discarded. The remaining samples from successive sections are then abutted to construct the final output.

Page 43: Review of Discrete Fourier Transformtwins.ee.nctu.edu.tw/courses/dsp_07/Chap8-ref.pdfUsing Circular Convolution to Implement Linear Convolution • Consider two sequences x 1[n] of

[email protected] 43

Step1

Page 44: Review of Discrete Fourier Transformtwins.ee.nctu.edu.tw/courses/dsp_07/Chap8-ref.pdfUsing Circular Convolution to Implement Linear Convolution • Consider two sequences x 1[n] of

[email protected] 44

Step2 &

Step3

Page 45: Review of Discrete Fourier Transformtwins.ee.nctu.edu.tw/courses/dsp_07/Chap8-ref.pdfUsing Circular Convolution to Implement Linear Convolution • Consider two sequences x 1[n] of

[email protected] 45

Fast Convolution with the FFT• Given two sequences x1 and x2 of length N1 and N2

respectively– Direct implementation requires N1N2 complex

multiplications• Consider using FFT to convolve two sequences:

– Pick N, a power of 2, such that N≥N1+N2-1– Zero-pad x1 and x2 to length N– Compute N-point FFTs of zero-padded x1 and x2, one

obtains X1 and X2– Multiply X1 and X2– Apply the IFFT to obtain the convolution sum of x1 and

x2– Computation complexity: 2(N/2) log2N + N + (N/2)log2N

Page 46: Review of Discrete Fourier Transformtwins.ee.nctu.edu.tw/courses/dsp_07/Chap8-ref.pdfUsing Circular Convolution to Implement Linear Convolution • Consider two sequences x 1[n] of

[email protected] 46

Example• A sequence x[n] of length 1024• FIR filter h[n] of length 34

• Direct computation: 34×1024=34816• Using radix-2 FFT: 35840 (N=2048)• Using overlap-add radix-2 FFT:

– x[n] is segmented into a set of contiguous blocks of equal length 95

– Apply radix-2 FFT of length 128– Each segment requires 1472 multiplications– This algorithm requires total 16192 multiplications