120
CHAPTER 5: DISCRETE FOURIER TRANSFORM (DFT) Lesson #19: DTFT of DT periodic signals Lesson #20: DFT and Inverse DFT Lesson #21: DFT properties Lesson #22: Fast Fourier Transform (FFT) Lesson #23: Applications of DFT/FFT Lesson #24: Using of DFT/FFT

Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

  • Upload
    xp2009

  • View
    58

  • Download
    2

Embed Size (px)

DESCRIPTION

dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Citation preview

Page 1: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

CHAPTER 5:

DISCRETE FOURIER TRANSFORM (DFT)

Lesson #19: DTFT of DT periodic signals

Lesson #20: DFT and Inverse DFT

Lesson #21: DFT properties

Lesson #22: Fast Fourier Transform (FFT)

Lesson #23: Applications of DFT/FFT

Lesson #24: Using of DFT/FFT

Page 2: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Lecture #19

DTFT of periodic signals

1. Review of Fourier Transforms (FT)

2. Fourier Series expansions

3. DTFT of periodic signals

Page 3: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

FT of CT periodic signals

Tdtetx

Taeatx

tjk

T

k

tjk

k

k

2;)(

1;)( 0

00

Discrete and aperiodic in frequency domain

Continuous and periodic in time domain

Page 4: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

FT of CT aperiodic signals

Continuous and aperiodic in time domain

1

Continuous and aperiodic in frequency domain

Page 5: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

FT of DT aperiodic signals

Discrete and aperiodic in time domain

Continuous and periodic in frequency with period 2π

Page 6: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Recapitulation

Page 7: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Can guess?

Page 8: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Lecture #19

DTFT of periodic signals

1. Review of Fourier Transforms (FT)

2. Fourier Series expansions

3. DTFT of periodic signals

Page 9: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Nn

njk

k

njk

Nk

k enxN

aeanx 00 ][1

;][ N

20

dtetxT

aeatxtjk

T

k

tjk

k

k00 )(

1;)(

• CT periodic signals with period T:

• DT periodic signals with period N:

Note: finite sums over an interval length of one periodic N

n)Nk(jn

N

2)Nk(jn

N

2jk

njk 00 eeee

T

20

Fourier Series expansion

Page 10: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Given a DT periodic signals with period N:

Example of Fourier Series expansion

[ ] [ ]k

p n n kN

N

1e]n[p

N

1a

1N

0n

N/n2jk

k

. . . -2N -N 0 N 2N . . . . .

1

0

2

][N

k

nN

jk

keanp

Page 11: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Lecture #19

DTFT of periodic signals

1. Review of Fourier Transforms (FT)

2. Fourier Series expansions

3. DTFT of periodic signals

Page 12: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

• CT periodic signals with period T:

• DT periodic signals with period N:

DTFT of periodic signals

)k(a2)(Xea)t(x0

kk

Ftjk

kk

0

)k(a2)(X]n[x0

kk

F

Page 13: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

. . . -2N -N 0 N 2N . . . . . . . . n

Example of calculating DTFT of

periodic signals

kk0k

N

2k

N

2ka2)(P

2π/N 2π/N 2π/N 2π/N 2π/N

. . . -4π/N -2π/N 0 2π/N 4π/N . . . . Ω

Height = 1

Spacing = N

Height = 2π/N

Spacing = 2π/N

Page 14: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Another approach to get DTFT of

periodic signals

0

[ ] 0 1[ ]

0 otherwise

x n n Nx n

0 N-1

x(n) is periodic signal; x0(n) is a part of x(n) that is repeated

Page 15: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Another approach (cont)

0

[ ] 0 1[ ]

0 otherwise

x n n Nx n

0 0 0[ ] [ ] [ ] [ ] [ ] [ ]k k k

x n x n kN x n n kN x n n kN

p(n) in previous example

0 0[ ] [ ] [ ] ( ) ( ) ( )F

x n x n p n X P X

Page 16: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Another approach (cont)

0 0[ ] [ ] [ ] ( ) ( ) ( )F

x n x n p n X P X

k

k

Nk

NkX

N

Nk

NXX

)2

()2

(2

)2

(2

)()(

0

0

It has N distinct values at k = 0, 1, …, N-1

Page 17: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Inverse DTFT

1

0

2

0

2

0

0

2

0

0

2

0

1

)2

(1

)2

()2

(1

)2

()2

(2

2

1

)(2

1][)(

N

k

N

nkj

k

nj

nj

k

nj

eN

kXN

deN

kN

kXN

deN

kN

kXN

deXnxXDFT

This is obtained from this property of the impulse:

elsewhere

btatfdttttf

b

a0

)()()(

00

0

Page 18: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Summary

Page 19: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Procedure to calculate DTFT of

periodic signals

Step 1:

Start with x0(n) – one period of x(n), with zero everywhere else

Step 2:

Find the DTFT X0(Ω) of the signal x0[n] above

Step 3:

Find X0(Ω) at N equally spacing frequency points X0(k2π/N)

Step 4:

Obtain the DTFT of x(n): k N

kN

kXN

X )2

()2

(2

)( 0

Page 20: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Example of calculating DTFT of

periodic signals

33

0

00 21)()( jj

n

nj eeenxX

k = 0 X0(0) = 4; k = 1 X0(1) = 1+j

k = 2 X0(2) = -2; k = 3 X0(3) = 1-j

0 1 2 3

Page 21: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Example (cont)

Page 22: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Example (cont)

Page 23: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

a) Draw the magnitude plot of the FT of a CT sinusoid x(t), that

has a frequency of 24 Hz

b) Sample this signal x(t) at 40 Hz. Draw the magnitude plot of

the FT of the sampled signal

c) Reconstruct a CT signal from the samples above with a LPF, it

will look like a CT sinusoid of what frequency?

d) Consider DT signal that is obtained by the sampling x(t) at a

sampling frequency of 40 Hz is x(n). Is x(n) a periodic signal?

If yes, what is its period?

e) Specify the DTFT of the DT signal x(n).

DTFT and DFS example

Page 24: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

a) Draw the magnitude plot of the FT of a CT sinusoid x(t), that has

a frequency of 24 Hz

The FT of a sinusoidal has nonzero values only at certain points

DTFT and DFS examples

-24 24 f [Hz]

-48π 48π ω [rad/s]

Page 25: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

b) Sample this signal x(t) at 40 Hz. Draw the magnitude plot of the

FT of the sampled signal

Sampled signal FT magnitude = copies of unsampled signal FT

magnitude; each copy is centered at k40(Hz) or k80π(rad/s)

DTFT and DFS examples

-64 -56 -24 -16 0 16 24 40 56 64 f[Hz]

-128π -48π -32π 32π 48π 80π 112π

ω[rad/s]

fs = 40Hz fs = 40Hz

8Hz

Page 26: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

c) Reconstruct a CT signal from the samples above with a LPF, it will

look like a CT sinusoid of what frequency?

The unit circle represents the scale of frequency range for a

signal sampled at 40Hz the reconstructed signal looks like

16Hz.

DTFT and DFS examples

20

24

16

0 16 24 40 56 64 f[Hz]

32π 48π 80π 112π ω[rad/s]

8Hz

Page 27: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

d) Consider DT signal that is obtained by the sampling x(t) at a

sampling frequency of 40 Hz is x(n). Is x(n) a periodic signal? If

yes, what is its period?

The unsampled signal: x(t) = cos(2π.24t)

The sampled signal:

x[n] = cos(2π.24.(1/40)t) = cos(6π/5)n = cos (4π/5)n

The sampled signal is periodic with N = 5

DTFT and DFS examples

Page 28: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

e) Specify the DTFT of the DT signal x(n).

DTFT and DFS examples

Page 29: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Lecture #20

DFT and inverse DFT

1. DFT and inverse DFT formulas

2. DFT and inverse DFT examples

3. Frequency resolution of the DFT

Page 30: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

DFT to the rescue!

Both CTFT and DTFT produce continuous function of

frequency can’t calculate an infinite continuum of frequencies

using a computer

Most real-world data is not in the form like anu(n)

DFT can be used as a FT approximation that can calculate a finite

set of discrete-frequency spectrum values from a finite set of

discrete-time samples of an analog signal

Could we calculate the frequency spectrum of a signal

using a digital computer with CTFT/DTFT?

Page 31: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Building the DFT formula

“Window” x(n) is like multiplying

the signal by the finite length

rectangular window

Discrete time

signal x(n)

Continuous time

signal x(t)

Discrete time

signal x0(n)

Finite length

sample

window

Page 32: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Building the DFT formula (cont)

Discrete time

signal x(n)

Continuous time

signal x(t)

Discrete time

signal x0(n)

Finite length

sample

window

DTFT

1

0

000 ][][)(N

n

nj

n

nj enxenxX

Page 33: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Building the DFT formula (cont)

Discrete time

signal x(n)

Continuous time

signal x(t)

Discrete time

signal x0(n)

Finite length

sample

window

DTFT

Sample

at N

values

around

the unit

circle

Discrete Fourier Transform DFT X(k)

Discrete + periodic with period N

X0(Ω)

Continuous + periodic

with period 2π

Page 34: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Notation conventions

Page 35: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Notation conventions (cont)

Page 36: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

DFT and inverse DFT formulas

Notation

You only have to store N points

N

2j

N eW

Page 37: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Lecture #20

DFT and inverse DFT

1. DFT and inverse DFT formulas

2. DFT and inverse DFT examples

3. Frequency resolution of the DFT

Page 38: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

DFT and IDFT examples

Ex.1. Find the DFT of x(n) = 1, n = 0, 1, 2, …, (N-1)

k = 0 X(k) = X(0) = N

k ≠ 0 X(k) = 0

Page 39: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

DFT and IDFT examples

Ex.2. Given y(n) = δ(n-2) and N = 8, find Y(k)

Page 40: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

DFT and IDFT examples

Ex.3. Find the IDFT of X(k) = 1, k = 0, 1, …, 7.

Page 41: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

DFT and IDFT examples

Ex.4. Given x(n) = δ(n) + 2δ(n-1) +3δ(n-2) + δ(n-3) and

N = 4. Find X(k).

Page 42: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

DFT and IDFT examples

Ex.5. Given X(k) = 2δ(k) + 2δ(k-2) and N = 4. Find x(n).

Page 43: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

DFT in matrix forms

)1)(1()1(21

)1(21

1

0

1

1

1111

]1[

]1[

]0[

]1[

]1[

]0[

:'

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

NN

N

N

N

N

N

N

NNN

N

NN

N

n

kn

N

WWW

WWWW

NX

X

X

X

Nx

x

x

x

definesLet

NkWnxkX

The N-point DFT may be expressed in matrix form as:

XN = WNxN

Page 44: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

IDFT in matrix forms

)1)(1()1(21

)1(21

1

0

1

1

1111

]1[

]1[

]0[

]1[

]1[

]0[

:'

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

][

NN

N

N

N

N

N

N

NNN

N

NN

N

k

kn

N

WWW

WWWW

NX

X

X

X

Nx

x

x

x

definesLet

NnWkXN

nx

The N-point DFT may be expressed in matrix form as:

matrixidentityI

NIWW

XWN

XWx

N

NNN

NNNNN

:

1

*

*1

Page 45: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Example of calculation of DFT in matrix form

Find DFT of the signal

x[n] =

δ[n-1] + 2δ[n-2] + 3δ[n-3]

j

jxWXThen

jj

jj

WWW

WWW

WWWW

x

definesLet

22

2

22

6

.

11

1111

11

1111

1

1

1

1111

3

2

1

0

:'

444

9

4

6

4

3

4

6

4

4

4

2

4

3

4

2

4

1

4

4

4

Page 46: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Lecture #20

DFT and inverse DFT

1. DFT and inverse DFT formulas

2. DFT and inverse DFT examples

3. Frequency resolution of the DFT

Page 47: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Discrete frequency spectrum computed from DFT has the

spacing between frequency samples of:

Frequency resolution of the DFT

N

ff s

N

2

The choice of N determines the resolution of the frequency

spectrum, or vice-versa

To obtain the adequate resolution:

1. Increasing of the duration of data input to the DFT

2. Zero padding, which adds no new information, but effects a better

interpolator

Page 48: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Examples of N = 5 and N = 15

Page 49: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Examples of N = 15 and N = 30

Page 50: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Lecture #21

DFT properties

1. Periodicity and Linearity

2. Circular time shift

3. Circular frequency shift

4. Circular convolution

5. Multiplication

6. Parseval’s theorem

Page 51: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

DFT properties

x(n)

Finite length

xp(n)

Periodic

N periodic extension

truncate

N periodic extension

truncate

X(k)

Finite length Xp(k)

Periodic

DFT

DFT

-1

Xp(Ω)

Periodic

DTFT

DTFT-1

Page 52: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

DFT properties

x(n)

Finite length

xp(n)

Periodic

N periodic extension

truncate

N periodic extension

truncate

X(k)

Finite length Xp(k)

Periodic

DFT

DFT

-1

Xp(Ω)

Periodic

DTFT

DTFT-1

Page 53: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Periodicity

x[n+N] = x[n] for all n

X[k+N] = X[k] for all k

If x[n] and X[k] are an N-point DFT pair, then

Page 54: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Linearity

Note: The length of x1[n] is same with the length of x2[n]

][][][][ 22112211 kXakXanxanxaDFT

Proof:

Infer from the definition formula of DFT

Page 55: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Lecture #21

DFT properties

1. Periodicity and Linearity

2. Circular time shift

3. Circular frequency shift

4. Circular convolution

5. Multiplication

6. Parseval’s theorem

Page 56: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Circular time shift property

]k[XW]mn[x kmDFT

Proof:

Infer from the relation between DFT and DTFT

][][)(

:2

)(][

2

kXWkXeXe

Nk

Xemnx

kmm

Njk

mj

mjDTFT

Page 57: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Circular

time

shift

Circular shift by m is the same as a shift by m modulo N

x(n)

xp(n)

xp(n+2)

x(n+2)

Page 58: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Lecture #21

DFT properties

1. Periodicity and Linearity

2. Circular time shift

3. Circular frequency shift

4. Circular convolution

5. Multiplication

6. Parseval’s theorem

Page 59: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Circular frequency shift property

][][ ln lkXWnxDFT

Proof:

Similar to the circular time shift property

Page 60: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Lecture #21

DFT properties

1. Periodicity and Linearity

2. Circular time shift

3. Circular frequency shift

4. Circular convolution

5. Multiplication

6. Parseval’s theorem

Page 61: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Circular convolution property

The non-zero length of x1(n) and x2(n) can be no longer

than N

The shift operation is circular shift

The flip operation is circular flip

1

0

212121 ][][][][][].[N

p

DFT

pnxpxnxnxkXkX

The circular convolution is not the linear convolution in chapter 2

Page 62: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Direct method to calculate circular

convolution

1. Draw a circle with N values of x(n) with N equally spaced angles

in a counterclockwise direction.

2. Draw a smaller radius circle with N values of h(n) with equally

spaced angles in a clockwise direction. Superimpose the centers of 2

circles, and have h(0) in front of x(0).

3. Calculate y(0) by multiplying the corresponding values on each

radial line, and then adding the products.

4. Find succeeding values of y(n) in the same way after rotating the

inner disk counterclockwise through the angle 2πk/N

Page 63: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Example to calculate circular convolution

Evaluate the circular convolution, y(n) of 2 signals:

x1(n) = [ 1 2 3 4 ]; x2(n) = [ 0 1 2 3 ]

1

2

3

4 0

1

2

3

y(0) = 16

1

2

3

4 1

2

3

0

y(1) = 18

Page 64: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Example (cont)

Evaluate the circular convolution, y(n) of 2 signals:

x1(n) = [ 1 2 3 4 ]; x2(n) = [ 0 1 2 3 ]

1

2

3

4 2

3

0

1

y(2) = 16

1

2

3

4 3

0

1

2

y(3) = 10

Page 65: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Another method to calculate circular convolution

x1(n)

x2(n)

X1(k)

X2(k)

DFT

DFT

IDFT y(n)

Ex. x1(n) = [ 1 2 3 4 ]; x2(n) = [ 0 1 2 3 ]

X1(k) = [ 10, -2+j2, -2, -2-j2 ];

X2(k) = [ 6, -2+j2, -2, -2-j2 ];

Y(k) = X1(k).X2(k) = [ 60, -j8, 4, j8 ]

y(n) = [ 16, 18, 16, 10 ]

Page 66: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Lecture #21

DFT properties

1. Periodicity and Linearity

2. Circular time shift

3. Circular frequency shift

4. Circular convolution

5. Multiplication

6. Parseval’s theorem

Page 67: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Multiplication

The non-zero length of X1(k) and X2(k) can be no longer

than N

The shift operation is circular shift

The flip operation is circular flip

1

0

212121 ][][1

][][1

][].[N

l

DFT

lkXlXN

kXkXN

nxnx

Page 68: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Lecture #21

DFT properties

1. Periodicity and Linearity

2. Circular time shift

3. Circular frequency shift

4. Circular convolution

5. Multiplication

6. Parseval’s theorem

Page 69: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Parseval’s theorem

The general form:

Special case:

1

0

1

0

][*][1

][*][N

k

N

n

kYkXN

nynx

1

0

21

0

2 |][|1

|][|N

k

N

n

kXN

nx

Page 70: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Parseval’s theorem example

Given x(n) = δ(n) + 2δ(n-1) +3δ(n-2) + δ(n-3) and N = 4.

1

0

2222222

22221

0

2

154

60)121127(

4

1|][|

1

151321|][|

N

k

N

n

kXN

nx

Page 71: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Multiple choice questions

Ex1:

It is desired to build a sampling system which takes a

recorded orchestra music signal s(t) and converts it to a

discretely-sampled form. In order to experimentally determine

the bandwidth (in frequency) of this signal the best transform

would be

a. The Fourier transform of a continuous function or a discrete

sequence

b. The Z-transform

c. The Fourier series

d. The discrete Fourier transform

Page 72: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Multiple choice questions

Ex2:

A mathematical model of human speech puts out a perfectly

periodic signal for steady vowel sounds. In order to accurately

determine the harmonics of the fundamental frequency for

this mathematical model, the best transform should be

a. The Fourier transform of a continuous function or a discrete

sequence

b. The Z-transform

c. The Fourier series

d. The discrete Fourier transform

Page 73: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Multiple choice questions

Ex3:

A student wishes to convolve the continuous-time mathematical

functions g(t) and h(t). She/he uniformly samples these

functions, and uses a computer to get, at best, an approximate

result. Another student claims to be able to get an exact result

via a transform. She/he must be thinking of which transform

a. The Fourier transform of a continuous function or a discrete

sequence

b. The Z-transform

c. The Fourier series

d. The discrete Fourier transform

Page 74: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Multiple choice questions

Ex4:

A student wishes to convolve the discrete-time mathematical

functions g(n) and h(n). She/he claims to be able to get an

exact result via one of the transforms below. She/he must be

thinking of which transforms

a. The Fourier transform of a continuous function or a discrete

sequence

b. The Z-transform

c. The Fourier series

d. The discrete Fourier transform

Page 75: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Lecture #22

Fast Fourier Transform (FFT)

1. What is FFT?

2. The decomposition-in-time Fast Fourier

Transform algorithm (DIT-FFT)

3. The decomposition-in-frequency Fast

Fourier Transform algorithm (DIF-FFT)

Page 76: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Using some "tricks" and choosing the appropriate N value, the DFT

can be implemented in a very computationally efficient way – this is

the Fast Fourier Transform (FFT) - which is the basis of lots of

contemporary DSP hardware

N

2j

N eW1Nn0W]k[XN

1]n[x

1Nk0W]n[x]k[X

1N

0n

nk

N

1N

0n

nk

N

Recall DFT and IDFT definition

Nth complex root of unity:

Page 77: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

What does it take to compute DFT or IDFT?

N2 complex multiplications for all N points of X(k) or x[n]

FFT: the algorithm to optimize the computational process by

breaking the N-point DFT into smaller DFTs

Ex.: N is a power of 2: split N-point DFT into two N/2-point DFTs,

then split each of these into two of length N/4, etc., until we

have N/2 subsequences of length 2

Cooley and Tukey (1965):

Fast Fourier Transform (FFT)

tionsmultiplicacomplex 2

log2

2N

NN

Page 78: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Some properties of can be exploited

Other useful properties:

Wnk

N

k andn in y periodicit ,

symmetry conjugatecomplex ,

)()(

*)(

WWW

WWWnNk

N

Nnk

N

kn

N

kn

N

nNk

N

knN

WW

WW

eWWWW

knN

kn

N

kn

N

kn

Njnkn

N

nN

N

kn

N

nN

k

N

2

2

2)

2(

oddn if ,

evenn if ,

FFT (cont)

Page 79: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

N Co

mp

lex m

ult

iplicati

on

nu

mb

ers

FFT

Comparison of DFT and FFT efficiency

Page 80: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Comparison of DFT and FFT efficiency

Number of Complex multiplications Complex multiplications Speed improvement

points N in direct DFT in FFT factor

4

8

16

32

64

128

256

512

1024

16

64

256

1,024

4,096

16,384

65,536

262,144

1,048,576

4

12

32

80

192

448

1,024

2,304

5,120

4.0

5.3

8.0

12.8

21.3

36.6

64.0

113.8

204.8

Page 81: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Lecture #22

Fast Fourier Transform (FFT)

1. What is FFT?

2. The decomposition-in-time Fast

Fourier Transform algorithm (DIT-FFT)

3. The decomposition-in-frequency Fast

Fourier Transform algorithm (DIF-FFT)

Page 82: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

G(k) is N/2 points DFT of the even numbered data: x(0),

x(2), x(4), …., x(N-2).

H(k) is the N/2 points DFT of the odd numbered data:

x(1), x(3), …, x(N-1).

even odd

[ ] [ ] [ ]kn kn

n n

X k x n W x n W

DIT-FFT with N as a 2-radix number

1N,...,1,0k ),k(H)k(G)k(X Wk

N

We divide X(k) into 2 parts:

Page 83: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

2 21 1

2 (2 1)

0 0

[ ] [2 ] [2 1]

N N

mk k m

m m

X k x m W x m W

2 21 1

2 2

0 0

[2 ]( ) [2 1]( )

N N

mk k mk

m m

x m W W x m W=

2/N

)2/N/(2j2N/2j2

NWeeW

G(k) and H(k) are of length N/2; X(k) is of length N

G(k)=G(k+N/2) and H(k)=H(k+N/2)

)()(][][)(

1

0

2/

1

0

2/

22

kHkGWmhWWmgkX Wk

Nm

mk

N

k

N

m

mk

N

NN

DIT-FFT (cont)

Note:

Page 84: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

4

k

848]k[HW]k[G]k[X

]3[HW]3[G]7[X]3[HW]3[G]3[X

]2[HW]2[G]6[X]2[HW]2[G]2[X

]1[HW]1[G]5[X]1[HW]1[G]1[X

]0[HW]0[G]4[X]0[HW]0[G]0[X

7

8

3

8

6

8

2

8

5

8

1

8

4

8

0

8

DIT-FFT of length N = 8

Page 85: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

DFT

N = 4

DFT

N = 4

# complex multiplications are reduced: 82 = 64 2x(4)2 + 8 = 40

Signal

flow

graph

for

8-point

FFT

Page 86: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

2424 ][][][ kHWkGkX k

DIT-FFT of length N = 4

]1[]1[]3[

]0[]0[]2[

]1[]1[]1[

]0[]0[]0[

3

4

2

4

1

4

0

4

HWGX

HWGX

HWGX

HWGX

]1[]1[]3[ 3

4 HWGX

]1[]1[]1[ 1

4 HWGX

]0[]0[]2[ 2

4 HWGX

]0[]0[]0[ 0

4 HWGX

DFT

N = 2

DFT

N = 2

W0

x[0]

x[2]

x[1]

x[3]

W1

W2

W3

# multiplications are reduced: 42 = 16 2x(2)2 + 4 = 12

Page 87: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

DIT-FFT of length N = 2

# multiplications are

reduced: 22 = 4 0;

just 2 additions!!! x[1] - 1

x[0] X[0]

X[1]

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

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

1,10,][][

1.11.0

0.10.0

2

21

0

xxWxWxX

xxWxWxX

eWkWnxkXj

n

nk

Butterfly diagram

Page 88: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

DFT

N = 4

DFT

N = 4

First step: split 8-point DFT into two 4-point DFTs

Example

of

8-point

FFT

Page 89: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

0W

0W

W4

W2

W0

W0

W6

W6

W2

W4

DFT N = 2

DFT N = 2

DFT N = 2

DFT N = 2

G[0]

G[1]

G[2]

G[3]

H[0]

H[1]

H[2]

H[3]

Example

of

8-point

FFT

(cont)

Second step: split each of 4-point DFT into two 2-point DFTs

Page 90: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Example

of

8-point

FFT

(cont) 0W

0W

W4

W2

W0

W0

W6

W6

W2

W4

Third step: combine all signal flow graphs of step 1 and step 2

W0

W1

W2

W3

W4

W5

W6

W7

There are 3 = log28 stages; 4 butterfly diagrams in each stage

Page 91: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Wr+N/2

Wr+N/2 = -Wr

Wr - 1

Butterfly diagram

Page 92: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Now the overall computation is reduced to:

tionsmultiplicacomplex 2

log2

2N

NN

The

overall

signal

flow

graph

for

8-point

DIT-FFT

Page 93: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Wr - 1

In-place computation

a

b

A

B

Each butterfly takes (a,b) to produce (A,B) no need to save

(a,b) can store (A,B) in the same locations as (a,b)

We need 2N store registers to store the results at each stage and

these registers are also used throughout the computation of the

N-point DFT

The order of the input: bit-reversed order

The order of the output: natural order

Page 94: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Lecture #22

Fast Fourier Transform (FFT)

1. What is FFT?

2. The decomposition-in-time Fast Fourier

Transform algorithm (DIT-FFT)

3. The decomposition-in-frequency Fast

Fourier Transform algorithm (DIF-FFT)

Page 95: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Rewrite the second half:

DIF-FFT with N as a 2-radix number

1)2/(

0

1)2/(

0

1

)2/( 2

2)( 22

N

n

kn

N

k

N

N

n

nk

N

N

Nn

kn

N WN

nxWWN

nxWnxNN

1,...,1,0 ,)()()(1)2/(

0

1

)2/(

NkWnxWnxkXN

n

N

Nn

kn

N

kn

N

kjNNkjk

N eeWN

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

We divide X(k) in half – first half and second half

Since:

then

1,...,1,0 ,)2/()1()()(1)2/(

0

NkWNnxnxkXN

n

kn

N

k

Page 96: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

DIF-FFT (cont)

12

,...,1,0 ,)2/()()12(

12

,...,1,0 ,)2/()()2(

1)2/(

0

2/

1)2/(

0

2/

NkWWNnxnxkX

NkWNnxnxkX

N

n

kn

N

n

N

N

n

kn

N

2

2/

2

NN WW

Decompose X(k) into two frequency sequences, even and odd:

Since:

then,

12

,...,1,0 ,)2/()()12(

12

,...,1,0 ,)2/()()2(

1)2/(

0

)12(

1)2/(

0

2

NkWNnxnxkX

NkWNnxnxkX

N

n

nk

N

N

n

kn

N

Page 97: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

DIF-FFT butterfly

x[n]

x[n+N/2]

x[n] + x[n+N/2]

(x[n] - x[n+N/2])WNn

-1 WN

n

Page 98: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

DIF-FFT of length N = 4

-1

-1

-1

-1 W41

W40

x[0] + x[2]

x[1] + x[3]

(x[0] - x[2])W40

(x[1] - x[3])W41

x[0]

x[1]

x[2]

x[3]

X[0]

X[2]

X[1]

X[3]

Page 99: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Lecture #23

DFT applications

1. Approximation of the Fourier Transform

of analog signals

2. Linear convolution

Page 100: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Approximation of Fourier Transform

Using DFT as a discrete-frequency approximation of the DTFT

and also an approximation of the CTFT

Step1. Determine the resolution ΔΩ = 2π/N required for the DFT to

be useful for its intended purpose determine N (N often = 2n)

Step 2. Determine the sampling frequency required to sample the

analog signal so as to avoid aliasing ωs ≥ 2ωM

Step 3. Accumulate N samples of the analog signal over N.T

seconds (T = 2π/ωs)

Step 4. Calculate DFT directly or using FFT algorithm

Page 101: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

0 0.5 1 1.5 2 2.5 30

0.5

1

n

f[n]

0 1 2 3 4 50

1

2

3

omega

mag

nitu

de

Example

f(t) = rect[(t-1)/2]

F(ω) = 2sinc(ω)e-jω

Ts = 1s

%Error of sample 1 = 50%

Page 102: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Example

0 5 10 150

0.5

1

n

f[n]

0 5 10 15 20 25 300

1

2

3

omega

mag

nitu

de

f(t) = rect[(t-1)/2]

F(ω) = 2sinc(ω)e-jω

Ts = 0.2s

%Error of sample 1 = 10%

Page 103: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

0 5 10 15 20 25 30 350

0.5

1

n

f[n]

0 10 20 30 40 50 60 700

1

2

3

omega

mag

nitu

de

Example

f(t) = rect[(t-1)/2]

F(ω) = 2sinc(ω)e-jω

Ts = 0.1s

%Error of sample 1 = 5%

Page 104: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Windowing

Source of error: truncation or “windowing” of the periodic

extension of the DT sequence implied in the DFT development

Windowing = multiplying the periodic extension of x[n] by a

rectangular function with duration N.T DFT involves a convolution

DFT = sampled(DTFT*sinc)

This multiplication causes spectrum-leakage distortion

To reduce the affect of spectrum-leakage distortion:

- Increase the sampling frequency

- Increase the number of samples

- Choose an appropriate windowing function (Hamming, Hanning)

Page 105: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Lecture #23

DFT applications

1. Approximation of the Fourier Transform of

analog signals

2. Linear convolution

Page 106: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Recall linear convolution

N1: the non-zero length of x1(n); N2: the non-zero

length of x2(n); Ny = N1 + N2 -1

The shift operation is the regular shift

The flip operation is the regular flip

p

pnxpxnxnxny ][][][*][][ 2121

Page 107: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Recall circular convolution

The non-zero length of x1(n) and x2(n) can be no longer

than N

The shift operation is circular shift

The flip operation is circular flip

1

0

2121 ][][][][][N

p

pnxpxnxnxny

Page 108: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Calculation of the linear convolution

The circular convolution of 2 sequences of length N1 and N2

can be made equal to the linear convolution of 2 sequences

by zero padding both sequences so that they both consists

of N1+N2-1 samples.

x1(n)

N1 samples

x2(n)

N2 samples

x’1(n)

x’2(n)

Zero padding

(N2-1) zeros IDFT

x1(n)*x2(n) Zero padding

(N1-1) zeros

DFT

DFT

Page 109: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Example of calculation of the linear convolution

x1(n) = [ 1 2 3 4 ]; x2(n) = [ 0 1 2 3 ]

x’1(n) = [ 1 2 3 4 0 0 0 ]; x’2(n) = [ 0 1 2 3 0 0 0 ]

X’1(k) = [ 10, -2.0245-j6.2240, 0.3460+j2.4791, 0.1784-j2.4220, 0.1784+j2.4220, 0.3460-j2.4791, -2.0245-j6.2240 ];

X’2(k) = [ 6, -2.5245-j4.0333, -0.1540+j2.2383, -0.3216-j1.7950, -0.3216+j1.7950, -0.1540-j2.2383, -2.5245+j4.0333];

Y’(k) = [ 60, -19.9928+j23.8775, -5.6024+j0.3927, -5.8342-j0.8644, -4.4049+j0.4585, -5.6024-j0.3927, -19.9928 +j23.8775 ]

IDFTY’(k) = y’(n) = [ 0 1 4 10 16 17 12 ]

Page 110: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Lecture #24

Using DFT/FFT

Page 111: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

The response, y(n) of a filter with the impulse response, h(n)

to an input, x(n) can be calculated by using the DFT

Limitations: All sample values of the signal must be

accumulated before the process begins

Great memory

Long time delay

Not suitable for long duration input

Solution: block filtering

Filtering

Page 112: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Divide long input signal, x(n) into non-overlapped blocks,

xb(n) of appropriate length for FFT calculation.

Convolve each block xb(n) and h(n) to get the output,

yb(n)

Overlap-add outputs, yb(n) together to form the output

signal, y(n)

Overlap-add technique in block filtering

Page 113: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Example of overlap-add technique

h(n)

x(n)

Page 114: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Example of overlap-add technique

x0(n)

x1(n)

x2(n)

Page 115: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Example (cont)

y0(n)

y1(n)

y2(n)

Page 116: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Prob.1 Prob. 5

12.10 12.18

Prob. 2 Prob. 6

12.11 12.22

Prob. 3 Prob. 7

12.12 12.24

Prob. 4 Prob. 8

12.15 12.30

HW

Page 117: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Prob.9

Given signals below and their DFT-5

HW

]n[]n[s)c(

]1n[]n[x)b(

]4n[4]3n[3]2n[2]1n[]n[x)a(

2

1

1. Find y[n] so that Y[k] = X1[k].X2[k]

2. Does x3[n] exist, if S[k] = X1[k].X3[k]?

Page 118: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Prob.10

Prove the Parseval’s theorem

HW

1

0

1

0

][*][1

][*][N

k

N

n

kYkXN

nynx

Page 119: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Lecture #20

DFT applications

1. Approximation of the Fourier Transform

of analog signals

2. Convolution

3. Filtering

4. Correlation

5. ESD estimation

Page 120: Chapter 5_dsp1_co thuc_full, dsp1, co thuc, xu li tin hieu, bkdn, dsp

Windowing

0 10 20 30 40 50 60 700

0.5

1

n

f[n]

0 5 10 15 20 25 30 350

1

2

3

omega

mag

nitu

de