60
1 The Discrete Fourier Transform: Its Properties and Applications 清大電機系林嘉文 [email protected] 03-5731152 Chapter 7 Frequency analysis of discrete-time signals is usually and most conveniently performed on a digital signal processor. To perform frequency analysis on a discrete-time signal, we convert the time-domain sequence to an equivalent frequency-domain representation. 2010/6/12 Introduction to Digital Signal Processing 2 Introduction { ( )} ( ) F xn X ω

DSP-chap7 2010cwlin/courses/dsp/notes/DSP... · 2010. 6. 11. · 2 Before we introduce the DFT, we consider the sampling of the Fourier transform of an aperiodic discrete-time sequence

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Page 1: DSP-chap7 2010cwlin/courses/dsp/notes/DSP... · 2010. 6. 11. · 2 Before we introduce the DFT, we consider the sampling of the Fourier transform of an aperiodic discrete-time sequence

1

The Discrete Fourier Transform: Its Properties and Applications

清大電機系林嘉文[email protected]

Chapter 7

� Frequency analysis of discrete-time signals is usually and most conveniently performed on a digital signal processor.

� To perform frequency analysis on a discrete-time signal, we convert the time-domain sequence to an equivalent frequency-domain representation.

2010/6/12 Introduction to Digital Signal Processing 2

Introduction

{ ( )} ( )Fx n X ω→

Page 2: DSP-chap7 2010cwlin/courses/dsp/notes/DSP... · 2010. 6. 11. · 2 Before we introduce the DFT, we consider the sampling of the Fourier transform of an aperiodic discrete-time sequence

2

� Before we introduce the DFT, we consider the sampling of the Fourier transform of an aperiodic discrete-time sequence.

� Thus, we establish the relationship between the sampled Fourier transform and the DFT.

2010/6/12 Introduction to Digital Signal Processing 3

Frequency-Domain Sampling: The Discrete Fourier Transform

� We recall that aperiodic finite-energy signals have continuous spectra.

� Let us consider such an aperiodic discrete-time signal with Fourier transform

2010/6/12 Introduction to Digital Signal Processing 4

Frequency-Domain Sampling and Reconstruction of Discrete-Time Signals

( )x n

( ) ( ) j n

n

X x n e ωω∞

=−∞

= ∑

Page 3: DSP-chap7 2010cwlin/courses/dsp/notes/DSP... · 2010. 6. 11. · 2 Before we introduce the DFT, we consider the sampling of the Fourier transform of an aperiodic discrete-time sequence

3

� Suppose that we sample periodically in frequency at a spacing of radius between successive samples.

� Since is periodic with period , only samples in the fundamental frequency range are necessary.

2010/6/12 Introduction to Digital Signal Processing 5

Frequency-Domain Sampling and Reconstruction of Discrete-Time Signals

( )X ωδω

( )X ω 2π

� For convenience, we take N equidistant samples in the interval with spacing , as shown below:

� Frequency-domain sampling of the Fourier transform

2010/6/12 Introduction to Digital Signal Processing 6

Frequency-Domain Sampling and Reconstruction of Discrete-Time Signals

2 / Nδω π=0 2ω π≤ <

Page 4: DSP-chap7 2010cwlin/courses/dsp/notes/DSP... · 2010. 6. 11. · 2 Before we introduce the DFT, we consider the sampling of the Fourier transform of an aperiodic discrete-time sequence

4

� First, we consider the selection of N, the number of samples in the frequency domain.

� If we evaluate at

� We obtain

2010/6/12 Introduction to Digital Signal Processing 7

Frequency-Domain Sampling and Reconstruction of Discrete-Time Signals

( ) ( ) j n

n

X x n e ωω∞

=−∞

= ∑ 2 /k Nω π=

2 /2( ) ( ) , 0,1,..., 1j kn N

n

X k x n e k NN

ππ ∞−

=−∞

= = −∑

� The summation above equation can be subdivided into an infinite number of summations, where each sum contains N terms. Thus

2010/6/12 Introduction to Digital Signal Processing 8

Frequency-Domain Sampling and Reconstruction of Discrete-Time Signals

1 12 / 2 /

0

2 12 /

12 /

2( ) ... ( ) ( )

( ) ...

= ( )

Nj kn N j kn N

n N n

Nj kn N

n N

lN Nj kn N

l n lN

X k x n e x n eN

x n e

x n e

π π

π

π

π − −− −

=− =

−−

=

∞ + −−

=−∞ =

= + +

+ +

∑ ∑

∑ ∑

Page 5: DSP-chap7 2010cwlin/courses/dsp/notes/DSP... · 2010. 6. 11. · 2 Before we introduce the DFT, we consider the sampling of the Fourier transform of an aperiodic discrete-time sequence

5

� If we change the index in the inner summation from n to n - lN and interchange the order of the summation, we obtain the result

2010/6/12 Introduction to Digital Signal Processing 9

Frequency-Domain Sampling and Reconstruction of Discrete-Time Signals

12 /

0

2( ) ( ) for 0,1,2,..., 1.

Nj kn N

n l

X k x n lN e k NN

ππ − ∞−

= =−∞

= − = −

∑ ∑

� The signal obtained by the

peoiodic repetition of every N samples, is clearly periodic with fundamental period N.

� It can be expanded in a Fourier series as

2010/6/12 Introduction to Digital Signal Processing 10

Frequency-Domain Sampling and Reconstruction of Discrete-Time Signals

( ) ( )pl

x n x n lN∞

=−∞

= −∑

( )x n

12 /

0

( ) , 0,1,..., 1N

j kn Np k

k

x n c e n Nπ−

=

= = −∑

Page 6: DSP-chap7 2010cwlin/courses/dsp/notes/DSP... · 2010. 6. 11. · 2 Before we introduce the DFT, we consider the sampling of the Fourier transform of an aperiodic discrete-time sequence

6

� With Fourier coefficients

� We can conclude that

2010/6/12 Introduction to Digital Signal Processing 11

Frequency-Domain Sampling and Reconstruction of Discrete-Time Signals

12 /

0

1( ) , 0,1,..., 1

Nj kn N

k pn

c x n e k NN

π−

=

= = −∑

1 2( ), 0,1,..., 1kc X k k N

N N

π= = −

12 /

0

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

Nj kn N

pk

x n X k e n NN N

ππ−

=

= = −∑

� The relationship in above equation provides the reconstruction of the periodic signal from the samples of the spectrum .

� However, it does not imply that we can recover or from the samples.

� To accomplish this, we need to consider the relationship between and .

2010/6/12 Introduction to Digital Signal Processing 12

Frequency-Domain Sampling and Reconstruction of Discrete-Time Signals

( )px n( )X ω

( )X ω( )x n

( )px n ( )x n

Page 7: DSP-chap7 2010cwlin/courses/dsp/notes/DSP... · 2010. 6. 11. · 2 Before we introduce the DFT, we consider the sampling of the Fourier transform of an aperiodic discrete-time sequence

7

� Since is the periodic extension of . It is clear that can be recovered from if there is no aliasing in the time domain, that is, if is time-limited to less than the period N of .

2010/6/12 Introduction to Digital Signal Processing 13

Frequency-Domain Sampling and Reconstruction of Discrete-Time Signals

( )px n ( )x n( )x n ( )px n

( )x n( )px n

Original signal

No aliasing

Aliasing

� We conclude that the spectrum of an aperiodic discrete-time signal with finite duration L can be exactly recovered from its samples at frequencies

� The procedure is to compute

then

and finally, can be computed.

2010/6/12 Introduction to Digital Signal Processing 14

Frequency-Domain Sampling and Reconstruction of Discrete-Time Signals

2 / , if k k N N Lω π= ≥

( ), 0,1,..., 1px n n N= −

( ), 0 1( )

0, elsewherepx n n N

x n≤ ≤ −

=

( )X ω

Page 8: DSP-chap7 2010cwlin/courses/dsp/notes/DSP... · 2010. 6. 11. · 2 Before we introduce the DFT, we consider the sampling of the Fourier transform of an aperiodic discrete-time sequence

8

� As in the case of continuous-time signals, it is possible to express the spectrum directly in terms of its samples . To derive such an interpolation formula for , we assume that .

� Since

2010/6/12 Introduction to Digital Signal Processing 15

Frequency-Domain Sampling and Reconstruction of Discrete-Time Signals

N L≥

( ) ( ) for 0 1px n x n n N= ≤ ≤ −

( )X ω(2 / ), 0,1,..., 1X k N k Nπ = −

( )X ω

12 /

0

1 2( ) ( ) , 0 1

Nj kn N

k

x n X k e n NN N

ππ−

=

= ≤ ≤ −∑

� If we use and substitute for , we obtain

2010/6/12 Introduction to Digital Signal Processing 16

Frequency-Domain Sampling and Reconstruction of Discrete-Time Signals

( )x n( ) ( ) j n

n

X x n e ωω∞

=−∞

= ∑

1 12 /

0 0

1 1( 2 / )

0 0

1 2( ) ( )

2 1 ( )

N Nj kn N j n

n k

N Nj k N n

k n

X X k e eN N

X k eN N

π ω

ω π

πω

π

− −−

= =

− −− −

= =

=

=

∑ ∑

∑ ∑

Page 9: DSP-chap7 2010cwlin/courses/dsp/notes/DSP... · 2010. 6. 11. · 2 Before we introduce the DFT, we consider the sampling of the Fourier transform of an aperiodic discrete-time sequence

9

� The inner summation term in the brackets of above represents the basic interpolation function shifted by in frequency. Indeed, if we define

2010/6/12 Introduction to Digital Signal Processing 17

Frequency-Domain Sampling and Reconstruction of Discrete-Time Signals

1

0

( 1)/2

1 1 1( )

1

sin( / 2)

sin( / 2)

j NNj n

jn

j N

eP e

N N e

Ne

N

ωω

ω

ω

ω

ωω

−−−

−=

− −

−= =

=

2 /k Nπ

� Then, we can obtain

� The interpolation function is not the familiar but instead, it is a periodic counterpart of it, and it is due to the periodic nature of .

2010/6/12 Introduction to Digital Signal Processing 18

Frequency-Domain Sampling and Reconstruction of Discrete-Time Signals

1

0

2 2( ) ( ) ( ),

N

k

X X k P k N LN N

π πω ω

=

= − ≥∑

( )P ω (sin ) /θ θ

( )X ω

Page 10: DSP-chap7 2010cwlin/courses/dsp/notes/DSP... · 2010. 6. 11. · 2 Before we introduce the DFT, we consider the sampling of the Fourier transform of an aperiodic discrete-time sequence

10

� The phase shift reflects the fact that the signal is a causal, finite-duration sequence of length N. The function

is plotted for N = 5.

2010/6/12 Introduction to Digital Signal Processing 19

Frequency-Domain Sampling and Reconstruction of Discrete-Time Signals

(sin / 2) / ( sin( / 2))N Nω ω

( )x n

� We observe that the function has the property

� Consequently, the interpolation formula gives exactly the sample values . At all other frequencies, the formula provides a properly weighted linear combination of the original spectral samples.

2010/6/12 Introduction to Digital Signal Processing 20

Frequency-Domain Sampling and Reconstruction of Discrete-Time Signals

( )P ω

1, 02( )

0, 1,2,..., 1

kP k

k NN

π ==

= −

(2 / ) for 2 /X k N k Nπ ω π=

Page 11: DSP-chap7 2010cwlin/courses/dsp/notes/DSP... · 2010. 6. 11. · 2 Before we introduce the DFT, we consider the sampling of the Fourier transform of an aperiodic discrete-time sequence

11

� Example : Consider the signal the spectrum of this signal is sampled at frequencies

� Determine the reconstructed spectra for when N=5 and N=50.

2010/6/12 Introduction to Digital Signal Processing 21

Frequency-Domain Sampling and Reconstruction of Discrete-Time Signals

( ) ( ), 0 1nx n a u n a= < <

2 / for 0,1,..., 1.k k N k Nω π= = −0.8a =

� Solution : The Fourier transform of the sequence is ( )x n

0

1( )

1n j n

jn

X a eae

ωωω

∞−

−=

= =−∑

� Suppose that we sample at N equidistant frequencies Thus we obtain the spectral samples

� The periodic sequence , corresponding to the frequency samples can be obtained.

2010/6/12 Introduction to Digital Signal Processing 22

Frequency-Domain Sampling and Reconstruction of Discrete-Time Signals

( )X ω2 / , 0,1,..., 1.k k N k Nω π= = −

2 /

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

1 j k N

kX k X k N

N ae π

πω

−≡ = = −

( )px n(2 / ), 0,1,..., 1X k N k Nπ = −

Page 12: DSP-chap7 2010cwlin/courses/dsp/notes/DSP... · 2010. 6. 11. · 2 Before we introduce the DFT, we consider the sampling of the Fourier transform of an aperiodic discrete-time sequence

12

� Hence

where the factor represents the effect of aliasing. Since , the aliasing error tends toward zero as .

2010/6/12 Introduction to Digital Signal Processing 23

Frequency-Domain Sampling and Reconstruction of Discrete-Time Signals

0

0

( ) ( )

, 0 11

n lNp

l l

nn lN

Nl

x n x n lN a

aa a n N

a

∞−

=−∞ =−∞

=

= − =

= = ≤ ≤ −−

∑ ∑

∑1/ (1 )Na−

0 1a< <N → ∞

� For , the sequence and its spectrum are shown below (a)(b):

2010/6/12 Introduction to Digital Signal Processing 24

Frequency-Domain Sampling and Reconstruction of Discrete-Time Signals

( )X ω( )x n0.8a =

Page 13: DSP-chap7 2010cwlin/courses/dsp/notes/DSP... · 2010. 6. 11. · 2 Before we introduce the DFT, we consider the sampling of the Fourier transform of an aperiodic discrete-time sequence

13

� The aliased sequences and the corresponding spectral samples are shown below (c)(d).

2010/6/12 Introduction to Digital Signal Processing 25

Frequency-Domain Sampling and Reconstruction of Discrete-Time Signals

( ) for 5 and 50px n N N= =

� We note that the aliasing effects are negligible for N=50.

� If we define the aliased finite-duration sequence

� Then its Fourier transform is

2010/6/12 Introduction to Digital Signal Processing 26

Frequency-Domain Sampling and Reconstruction of Discrete-Time Signals

( ) asx n

( ), 0 1ˆ( )

0, otherwisepx n n N

x n≤ ≤ −

=

1 1

0 0

1 1ˆ ˆ( ) ( ) ( )1 1

N j nN Nj n j N

p N jn n

a eX x n e x n e

a ae

ωω ω

ωω−− −

− −−

= =

−= = = ⋅

− −∑ ∑

Page 14: DSP-chap7 2010cwlin/courses/dsp/notes/DSP... · 2010. 6. 11. · 2 Before we introduce the DFT, we consider the sampling of the Fourier transform of an aperiodic discrete-time sequence

14

� Note that although , the sample values atare identical. That is,

2010/6/12 Introduction to Digital Signal Processing 27

Frequency-Domain Sampling and Reconstruction of Discrete-Time Signals

2 /k k Nω π=

ˆ ( ) ( )X Xω ω≠

2

2 1 1 2ˆ ( ) ( )1 1

N

N j kN

aX k X k

N a ae Nπ

π π−

−= ⋅ =

− −

� The development in the preceding section is concerned with the frequency-domain sampling of an aperiodic finite-energy sequence .

� In general, the equally spaced frequency samples

do not uniquely represent the original sequence when has infinite duration.

2010/6/12 Introduction to Digital Signal Processing 28

The Discrete Fourier Transform (DFT)

( )x n

(2 / ), 0,1,..., 1,X k N k Nπ = −

( )x n( )x n

Page 15: DSP-chap7 2010cwlin/courses/dsp/notes/DSP... · 2010. 6. 11. · 2 Before we introduce the DFT, we consider the sampling of the Fourier transform of an aperiodic discrete-time sequence

15

� Instead, the frequency samples

correspond to a periodic sequence of period N, where is an aliased version of , as indicated by the relation in the preceding equation, that is,

2010/6/12 Introduction to Digital Signal Processing 29

The Discrete Fourier Transform (DFT)

(2 / ), 0,1,..., 1,X k N k Nπ = −

( )px n( )x n( )px n

( ) ( ).pl

x n x n lN∞

=−∞

= −∑

� When the sequence has a finite duration of length , then is simply a periodic repetition of ,

where over a single period is given as

� Consequently, the frequency samples

uniquely represent the finite-duration sequence .

2010/6/12 Introduction to Digital Signal Processing 30

The Discrete Fourier Transform (DFT)

( )px n( )x n

L N≤ ( )x n( )px n

( ), 0 1( )

0, 1p

x n n Lx n

L n N

≤ ≤ −=

≤ ≤ −

(2 / ), 0,1,..., 1,X k N k Nπ = −

( )x n

Page 16: DSP-chap7 2010cwlin/courses/dsp/notes/DSP... · 2010. 6. 11. · 2 Before we introduce the DFT, we consider the sampling of the Fourier transform of an aperiodic discrete-time sequence

16

� Since over a single period (padded by N-L zeros), the original finite-duration sequence can be obtained from the frequency samples by means of the formula

2010/6/12 Introduction to Digital Signal Processing 31

The Discrete Fourier Transform (DFT)

( ) ( )px n x n≡( )x n

{ (2 / )}X k Nπ

12 /

0

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

Nj kn N

pk

x n X k e n NN N

ππ−

=

= = −∑

� Note that zero padding does not provide any additional information about the spectrum of the sequence

.

� In summary, a finite-duration sequence of length Lhas a Fourier transform

� Where the upper and lower indices in the summation reflect the fact that outside the range

2010/6/12 Introduction to Digital Signal Processing 32

The Discrete Fourier Transform (DFT)

{ ( )}x n( )X ω

( )x n

1

0

( ) ( ) , 0 2L

j n

n

X x n e ωω ω π−

=

= ≤ ≤∑

( ) 0x n = 0 1.n L≤ ≤ −

Page 17: DSP-chap7 2010cwlin/courses/dsp/notes/DSP... · 2010. 6. 11. · 2 Before we introduce the DFT, we consider the sampling of the Fourier transform of an aperiodic discrete-time sequence

17

� When we sample at equally spaced frequencies

the resultant samples are

where for convenience, the upper index in the sum has been increased from L-1 to N-1 since x(n)=0 for .

2010/6/12 Introduction to Digital Signal Processing 33

The Discrete Fourier Transform (DFT)

2 / , 0,1,2,..., 1, where N Lk k N k Nω π= = − ≥

( )X ω

12 /

0

12 /

0

2( ) ( ) ( )

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

Lj kn N

n

Nj kn N

n

kX k X x n e

N

X k x n e k N

π

π

π −−

=

−−

=

≡ =

= = −

n L≥

� The relation

is called the discrete Fourier transform (DFT) of x(n).

2010/6/12 Introduction to Digital Signal Processing 34

The Discrete Fourier Transform (DFT)

12 /

0

12 /

0

2( ) ( ) ( )

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

Lj kn N

n

Nj kn N

n

kX k X x n e

N

X k x n e k N

π

π

π −−

=

−−

=

≡ =

= = −

Page 18: DSP-chap7 2010cwlin/courses/dsp/notes/DSP... · 2010. 6. 11. · 2 Before we introduce the DFT, we consider the sampling of the Fourier transform of an aperiodic discrete-time sequence

18

� To summarize, the formulas for the DFT and IDFT are

2010/6/12 Introduction to Digital Signal Processing 35

The Discrete Fourier Transform (DFT)

12 /

0

12 /

0

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

1( ) ( ) , n 0,1,2,..., 1

Nj kn N

n

Nj kn N

k

X k x n e k N

x n X k e NN

π

π

−−

=

=

= = −

= = −

DFT:

IDFT:

� Example : A finite-duration sequence of length L is given

as

Determine the N-point DFT of this sequence for .

2010/6/12 Introduction to Digital Signal Processing 36

N L≥� Solution : The Fourier transform of this sequence is

1, 0 1( )

0, otherwise

n Lx n

≤ ≤ −=

The Discrete Fourier Transform (DFT)

1 1

0 0

( 1)/2

( ) ( )

1 sin( / 2)

1 sin( / 2)

L Lj n j n

n n

j Lj L

j

X x n e e

e Le

e

ω ω

ωω

ω

ω

ωω

− −− −

= =

−− −

= =

−= =

∑ ∑

Page 19: DSP-chap7 2010cwlin/courses/dsp/notes/DSP... · 2010. 6. 11. · 2 Before we introduce the DFT, we consider the sampling of the Fourier transform of an aperiodic discrete-time sequence

19

� The magnitude and phase of are illustrated in the below for L=10.

2010/6/12 Introduction to Digital Signal Processing 37

The Discrete Fourier Transform (DFT)

( )X ω

Magnitude

Phase

� The N-point DFT of x(n) is simply evaluated at the set of N equally spaced frequencies

� Hence

2010/6/12 Introduction to Digital Signal Processing 38

The Discrete Fourier Transform (DFT)

( )X ω

2 / , 0,1,..., 1.k k N k Nω π= = −

2 /

2 /

( 1)/

1( ) , 0,1,..., 1

1sin( / )

sin( / )

j kL N

j k N

j k L N

eX k k N

ekL N

ek N

π

π

πππ

− −

−= = −

=

Page 20: DSP-chap7 2010cwlin/courses/dsp/notes/DSP... · 2010. 6. 11. · 2 Before we introduce the DFT, we consider the sampling of the Fourier transform of an aperiodic discrete-time sequence

20

� If N is selected such that N=L, then the DFT becomes

2010/6/12 Introduction to Digital Signal Processing 39

The Discrete Fourier Transform (DFT)

, 0( )

0, 1,2,..., 1

L kX k

k L

==

= −

2010/6/12 Introduction to Digital Signal Processing 40

The Discrete Fourier Transform (DFT)

N=50 N=100

Page 21: DSP-chap7 2010cwlin/courses/dsp/notes/DSP... · 2010. 6. 11. · 2 Before we introduce the DFT, we consider the sampling of the Fourier transform of an aperiodic discrete-time sequence

21

� The formulas for the DFT and IDFT may be expressed as

which is an Nth root of unity.

2010/6/12 Introduction to Digital Signal Processing 41

The DFT as a Linear Transformation

1

0

1

0

2 /

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

1( ) ( ) , n 0,1,2,..., 1

where

Nkn

Nn

Nkn

Nk

j NN

X k x n W k N

x n X k W NN

W e π

=

−−

=

= = −

= = −

=

� We note that the computation of each point of the DFT can be accomplished by N complex multiplications and (N-1) complex additions.

� Hence the N-point DFT values can be computed in a total of N2 complex multiplications and N(N-1) complex additions.

� It is instructive to view the DFT and IDFT as linear transformations on sequences and , respectively.

2010/6/12 Introduction to Digital Signal Processing 42

The DFT as a Linear Transformation

{ ( )}x n { ( )}X k

Page 22: DSP-chap7 2010cwlin/courses/dsp/notes/DSP... · 2010. 6. 11. · 2 Before we introduce the DFT, we consider the sampling of the Fourier transform of an aperiodic discrete-time sequence

22

� Let us define an N-point vector xN of the signal sequence x(n), n=0,1,…,N-1, an N-point vector XN of frequency samples, and an N×N matrix WN as

� With these definitions, the N-point DFT may be expressed in matrix forms as .

� Where is the matrix of the linear transformation.

2010/6/12 Introduction to Digital Signal Processing 43

The DFT as a Linear Transformation

2 1

2 4 2( 1)

1 2( 1) ( 1)( 1)

1 1 1 1(0) X(0)

1(1) X(1)

x , X , W

( 1) X( 1)1

NN N N

NN N N N N N

N N N NN N N

xW W W

xW W W

x N NW W W

− − − −

= = = − −

� �� �

� � � � �

X W xN N N=

WN

� We observe that is a symmetric matrix.

� If we assume that the inverse of exists, then

� But this is just an expression for the IDFT.

� In fact, the IDFT can be expressed in matrix form as

2010/6/12 Introduction to Digital Signal Processing 44

The DFT as a Linear Transformation

WN

WN

1x W XN N N−=

*1x W X

NN NN=

Page 23: DSP-chap7 2010cwlin/courses/dsp/notes/DSP... · 2010. 6. 11. · 2 Before we introduce the DFT, we consider the sampling of the Fourier transform of an aperiodic discrete-time sequence

23

� Where denotes the complex conjugate of the matrix . Then we can conclude that

� Which, in turn, implies that

� Where is an N×N identity matrix.

2010/6/12 Introduction to Digital Signal Processing 45

The DFT as a Linear Transformation

WN

*WN

1 *1W W

N NN− =

*W W IN N NN=

I N

� Therefore, the matrix in the transformation is an orthogonal (unitary) matrix.

� Furthermore, its inverse exists and is given as .

� Of course, the existence of the inverse of was established previously from our derivation of the IDFT.

2010/6/12 Introduction to Digital Signal Processing 46

The DFT as a Linear Transformation

WN

*W /N

N

WN

Page 24: DSP-chap7 2010cwlin/courses/dsp/notes/DSP... · 2010. 6. 11. · 2 Before we introduce the DFT, we consider the sampling of the Fourier transform of an aperiodic discrete-time sequence

24

� The DFT and IDFT are computational tools that play a very important role in many digital signal processing applications, such as frequency analysis (spectrum analysis) of signals, power spectrum estimation, and linear filtering.

� The importance of the DFT and IDFT in such practical applications is due to a large extent to the existence of computationally efficient algorithms, known collectively as fast Fourier transform (FFT) algorithms, for computing the DFT and IDFT.

2010/6/12 Introduction to Digital Signal Processing 47

The DFT as a Linear Transformation

� Relationship to the Fourier series coefficients of a periodic sequence

� A periodic sequence with fundamental period Ncan be represented in a Fourier series of the form

� Where is the Fourier series coefficients.

2010/6/12 Introduction to Digital Signal Processing 48

Relationship of the DFT to Other Transforms

{ ( )}px n

12 /

0

12 /

0

( ) ,

1( ) , 0,1,.., 1

Nj kn N

p kk

Nj kn N

k pn

x n c e n

c x n e k NN

π

π

=

−−

=

= −∞ < < ∞

= = −

∑kc

Page 25: DSP-chap7 2010cwlin/courses/dsp/notes/DSP... · 2010. 6. 11. · 2 Before we introduce the DFT, we consider the sampling of the Fourier transform of an aperiodic discrete-time sequence

25

� Relationship to the Fourier transform of an aperiod icsequence

� If is an aperiodic finite energy sequence with Fourier transform , which is sampled at N equally spaced frequencies the spectral components

are the DFT coefficients of the periodic sequence of period N.

2010/6/12 Introduction to Digital Signal Processing 49

Relationship of the DFT to Other Transforms

2 /2 /( ) ( ) | ( ) , 0,1,.., 1j kn N

k Nn

X k X x n e k Nπω πω

∞−

==−∞

= = = −∑

2 / , 0,1,..., 1,k k N k Nω π= = −

( )x n( )X ω

� Relationship to the Fourier transform of an aperiod icsequence

� Thus is determined by aliasing over the interval . The finite-duration sequence

2010/6/12 Introduction to Digital Signal Processing 50

Relationship of the DFT to Other Transforms

{ ( )}x n0 1n N≤ ≤ −

( ) ( )pl

x n x n lN∞

=−∞

= −∑

( )px n

( ), 0 1ˆ( )

0, otherwisepx n n N

x n≤ ≤ −

=

Page 26: DSP-chap7 2010cwlin/courses/dsp/notes/DSP... · 2010. 6. 11. · 2 Before we introduce the DFT, we consider the sampling of the Fourier transform of an aperiodic discrete-time sequence

26

� Relationship to the Fourier transform of an aperiod icsequence

� Bears no resemblance to the original sequence , unless is of finite duration and length , in which case

� Only in this case will the IDFT of yield the original sequence .

2010/6/12 Introduction to Digital Signal Processing 51

Relationship of the DFT to Other Transforms

{ ( )}x n( )x n

ˆ( ) ( ), 0 1x n x n n N= ≤ ≤ −L N≤

{ ( )}X k{ ( )}x n

� Relationship to the Fourier transform of an aperiod icsequence

� Bears no resemblance to the original sequence , unless is of finite duration and length , in which case

� Only in this case will the IDFT of yield the original sequence .

2010/6/12 Introduction to Digital Signal Processing 52

Relationship of the DFT to Other Transforms

{ ( )}x n( )x n

ˆ( ) ( ), 0 1x n x n n N= ≤ ≤ −L N≤

{ ( )}X k{ ( )}x n

Page 27: DSP-chap7 2010cwlin/courses/dsp/notes/DSP... · 2010. 6. 11. · 2 Before we introduce the DFT, we consider the sampling of the Fourier transform of an aperiodic discrete-time sequence

27

� Relationship to the z-transform

� Consider a sequence having the z-transform

with an ROC that includes the unit circle.

2010/6/12 Introduction to Digital Signal Processing 53

Relationship of the DFT to Other Transforms

( )x n

( ) ( ) n

n

X z x n z∞

=−∞

= ∑

� Relationship to the z-transform

� If is sampled at the N equally spaced points on the unit circle , we obtain

2010/6/12 Introduction to Digital Signal Processing 54

Relationship of the DFT to Other Transforms

( )X z2 / , 0,1,2,..., 1j k N

kz e k Nπ= = −

2 /

2 /

( ) ( ) | , 0,1,.., 1

( )

j nk Nz e

j nk N

n

X k X z k N

x n e

π

π

=

∞−

=−∞

≡ = −

= ∑

Page 28: DSP-chap7 2010cwlin/courses/dsp/notes/DSP... · 2010. 6. 11. · 2 Before we introduce the DFT, we consider the sampling of the Fourier transform of an aperiodic discrete-time sequence

28

� Relationship to the Fourier series coefficients of a continuous-time signal

� Suppose that is a continuous-time periodic signal with fundamental period . The signal can be expressed in a Fourier series

� Where are the Fourier coefficients.

2010/6/12 Introduction to Digital Signal Processing 55

Relationship of the DFT to Other Transforms

( )ax t

01/pT F=

02( ) j ktFa k

k

x t c e π∞

=−∞

= ∑{ }kc

� Relationship to the Fourier series coefficients of a continuous-time signal

� If we sample at a uniform rate , we obtain the discrete-time sequence

2010/6/12 Introduction to Digital Signal Processing 56

Relationship of the DFT to Other Transforms

( )ax t / 1/s pF N T T= =

02 2 /

12 /

0

( ) ( )

j kF nT j kn Na k k

k k

Nj kn N

k lNk l

x n x nt c e c e

c e

π π

π

∞ ∞

=−∞ =−∞

− ∞

−= =−∞

≡ = =

=

∑ ∑

∑ ∑

Page 29: DSP-chap7 2010cwlin/courses/dsp/notes/DSP... · 2010. 6. 11. · 2 Before we introduce the DFT, we consider the sampling of the Fourier transform of an aperiodic discrete-time sequence

29

� Relationship to the Fourier series coefficients of a continuous-time signal

� It is clear the above equation is in the form of an IDFT formula, where

� Thus the sequence is an aliased version of the sequence .

2010/6/12 Introduction to Digital Signal Processing 57

Relationship of the DFT to Other Transforms

( ) and k lN k k k lNl l

X k N c Nc c c∞ ∞

− −=−∞ =−∞

= ≡ =∑ ∑� �

{ }kc�{ }kc

� The DFT as a set of N samples of the Fourier transform for a finite-duration sequence of length .

� The sampling of occurs at the N equally spaced frequencies

2010/6/12 Introduction to Digital Signal Processing 58

Properties of the DFT

{ ( )}X k( )X ω { ( )}x n

L N≤

( )X ω2 / , 0,1,2,..., 1.k k N k Nω π= = −

1

0

1

0

2 /

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

1( ) ( ) , n 0,1,2,..., 1

where

Nkn

Nn

Nkn

Nk

j NN

X k x n W k N

x n X k W NN

W e π

=

−−

=

= = −

= = −

=

DFT:

IDFT:( ) ( )DFT

Nx n X k←→

Page 30: DSP-chap7 2010cwlin/courses/dsp/notes/DSP... · 2010. 6. 11. · 2 Before we introduce the DFT, we consider the sampling of the Fourier transform of an aperiodic discrete-time sequence

30

� Periodicity . If and are an N-point DFT pair, then

� Linearity . If

then for any real-valued or complex-valued constants and ,

2010/6/12 Introduction to Digital Signal Processing 59

Periodicity, Linearity, and Symmetry Properties

( )X k( )x n

( ) ( )

( ) ( )

x n N x n n

X k N X k k

+ = ∀

+ = ∀

1 1 2 2( ) ( ) and ( ) ( )DFT DFTN N

x n X k x n X k←→ ←→

1a2a

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

a x n a x n a X k a X k+ ←→ +

� Circular Symmetries of a Sequence . As we have seen, the N-point DFT of a finite duration sequence , of length , is equivalent to the N-point DFT of a periodic sequence , of period N, which is obtained by periodically extending , that is

2010/6/12 Introduction to Digital Signal Processing 60

Periodicity, Linearity, and Symmetry Properties

( )x nL N≤

( )px n( )x n

( ) ( )pl

x n x n lN∞

=−∞

= −∑

Page 31: DSP-chap7 2010cwlin/courses/dsp/notes/DSP... · 2010. 6. 11. · 2 Before we introduce the DFT, we consider the sampling of the Fourier transform of an aperiodic discrete-time sequence

31

� Circular Symmetries of a Sequence . Suppose that we shift the periodic sequence by k units to the right. Thus we obtain another periodic sequence

� The finite-duration sequence

is related to the original sequence by a circular shift.

2010/6/12 Introduction to Digital Signal Processing 61

Periodicity, Linearity, and Symmetry Properties

( )px n

' ( ) ( ) ( )p pl

x n x n k x n k lN∞

=−∞

= − = − −∑

' ( ), 0 1'( )

0, otherwisepx n n N

x n ≤ ≤ −

=

( )x n

� Circular Symmetries of a Sequence . This relationship is illustrated as below for N=4.

2010/6/12 Introduction to Digital Signal Processing 62

Periodicity, Linearity, and Symmetry Properties

Page 32: DSP-chap7 2010cwlin/courses/dsp/notes/DSP... · 2010. 6. 11. · 2 Before we introduce the DFT, we consider the sampling of the Fourier transform of an aperiodic discrete-time sequence

32

� Circular Symmetries of a Sequence .

� In general, the circular shift of the sequence can be represented as the index modulo N. thus we can write

� Time reversal of N-point sequence

2010/6/12 Introduction to Digital Signal Processing 63

Periodicity, Linearity, and Symmetry Properties

'( ) ( , modulo )

(( ))N

x n x n k N

x n k

= −

= −

(( )) ( ), 0 1Nx n x N n n N− = − ≤ ≤ −

� Circular Symmetries of a Sequence . An equivalent definition of even and odd sequences for the associated periodic sequence is given as follows

� If the periodic sequence is complex valued, we have

2010/6/12 Introduction to Digital Signal Processing 64

Periodicity, Linearity, and Symmetry Properties

( )px n

( ) ( ) ( )

( ) ( ) ( )p p p

p p p

x n x n x N n

x n x n x N n

= − = −

= − − = − −

Even:

Odd:

*

*

( ) ( )

( ) ( )

p p

p p

x n x N n

x n x N n

= −

= − −

Conjugate even:

Conjugate odd:

Page 33: DSP-chap7 2010cwlin/courses/dsp/notes/DSP... · 2010. 6. 11. · 2 Before we introduce the DFT, we consider the sampling of the Fourier transform of an aperiodic discrete-time sequence

33

� Circular Symmetries of a Sequence . These relationships suggest that we decompose the sequence as

where

2010/6/12 Introduction to Digital Signal Processing 65

Periodicity, Linearity, and Symmetry Properties

( )px n

( ) ( ) ( )p pe pox n x n x n= +

*

*

1( ) [ ( ) ( )]

21

( ) [ ( ) ( )]2

pe p p

po p p

x n x n x N n

x n x n x N n

= + −

= − −

� Symmetry properties of the DFT . The sequences can be expressed as

� We can obtain

2010/6/12 Introduction to Digital Signal Processing 66

Periodicity, Linearity, and Symmetry Properties

( ) ( ) ( ), 0 1

( ) ( ) ( ), 0 1R I

R I

x n x n jx n n N

X k X k jX k k N

= + ≤ ≤ −

= + ≤ ≤ −

1

0

1

0

2 2( ) ( )cos ( )sin

2 2( ) ( )sin ( )cos

N

R R In

N

I R In

kn knX k x n x n

N N

kn knX k x n x n

N N

π π

π π

=

=

= +

= − −

Page 34: DSP-chap7 2010cwlin/courses/dsp/notes/DSP... · 2010. 6. 11. · 2 Before we introduce the DFT, we consider the sampling of the Fourier transform of an aperiodic discrete-time sequence

34

� Symmetry properties of the DFT .

� Similarly,

2010/6/12 Introduction to Digital Signal Processing 67

Periodicity, Linearity, and Symmetry Properties

1

0

1

0

1 2 2( ) ( )cos ( )sin

1 2 2( ) ( )sin ( )cos

N

R R Ik

N

I R Ik

kn knx n X k X k

N N N

kn knx k X k X k

N N N

π π

π π

=

=

= −

= +

� Real-valued sequences . If the sequence is real, it follows

� Consequently,

2010/6/12 Introduction to Digital Signal Processing 68

Periodicity, Linearity, and Symmetry Properties

*( ) ( ) ( )X N k X k X k− = = −

( )x n

( ) ( )

( ) ( )

X N k X k

X N k X k

− =

∠ − = −∠

Page 35: DSP-chap7 2010cwlin/courses/dsp/notes/DSP... · 2010. 6. 11. · 2 Before we introduce the DFT, we consider the sampling of the Fourier transform of an aperiodic discrete-time sequence

35

� Real and even sequences . If is real and even, that is

� And . Hence the DFT reduces to

� IDFT

2010/6/12 Introduction to Digital Signal Processing 69

Periodicity, Linearity, and Symmetry Properties

( ) ( ), 0 1x n x N n n N= − ≤ ≤ −

( )x n

1

0

2( ) ( )cos , 0 1

N

n

knX k x n k N

N

π−

=

= ≤ ≤ −∑

( ) 0IX k =

1

0

1 2( ) ( )cos , 0 1

N

k

knx n X k n N

N N

π−

=

= ≤ ≤ −∑

� Real and odd sequences . If is real and odd, that is

� And . Hence the DFT reduces to

� IDFT

2010/6/12 Introduction to Digital Signal Processing 70

Periodicity, Linearity, and Symmetry Properties

( ) ( ), 0 1x n x N n n N= − − ≤ ≤ −

( )x n

1

0

2( ) ( )sin , 0 1

N

n

knX k j x n k N

N

π−

=

= − ≤ ≤ −∑

( ) 0RX k =

1

0

1 2( ) ( )sin , 0 1

N

k

knx n j X k n N

N N

π−

=

= ≤ ≤ −∑

Page 36: DSP-chap7 2010cwlin/courses/dsp/notes/DSP... · 2010. 6. 11. · 2 Before we introduce the DFT, we consider the sampling of the Fourier transform of an aperiodic discrete-time sequence

36

� Purely imaginary sequences .

� We observe that is odd and is even.

2010/6/12 Introduction to Digital Signal Processing 71

Periodicity, Linearity, and Symmetry Properties

( ) ( )Ix n jx n=

1

0

1

0

2( ) ( )sin

2( ) ( )cos

N

R In

N

I In

knX k x n

N

knX k x n

N

π

π

=

=

=

=

( )RX k ( )IX k

2010/6/12 Introduction to Digital Signal Processing 72

Periodicity, Linearity, and Symmetry Properties

Page 37: DSP-chap7 2010cwlin/courses/dsp/notes/DSP... · 2010. 6. 11. · 2 Before we introduce the DFT, we consider the sampling of the Fourier transform of an aperiodic discrete-time sequence

37

� Suppose that we have two finite-duration sequences of length N, . Their respective N-point DFTs are

� If we multiply the two DFTs together, the result is a DFT, say , of a sequence of length N.

2010/6/12 Introduction to Digital Signal Processing 73

Multiplication of Two DFTs and Circular Convolution

1 2( ) and ( )x n x n

12 /

1 10

12 /

2 20

( ) ( ) , 0,1,..., 1

( ) ( ) , 0,1,..., 1

Nj nk N

n

Nj nk N

n

X k x n e k N

X k x n e k N

π

π

−−

=

−−

=

= = −

= = −

3( )X k 3( )x n

3 1 2( ) ( ) ( ), 0,1,..., 1X k X k X k k N= = −

� The IDFT of is

� Suppose that we substitute for using the DFTs, thus we obtain

2010/6/12 Introduction to Digital Signal Processing 74

Multiplication of Two DFTs and Circular Convolution

1 12 / 2 /

3 3 1 20 0

1 1( ) ( ) ( ) ( )

N Nj km N j km N

k k

x m X k e X k X k eN N

π π− −

= =

= =∑ ∑

3{ ( )}X k

1 2( ) and ( )X k X k

1 1 12 / 2 / 2 /

3 1 20 0 0

1 1 12 ( )/

1 20 0 0

1( ) ( ) ( )

1 ( ) ( )

N N Nj kn N j kn N j km N

k n l

N N Nj k m n l N

n l k

x m x n e x l e eN

x n x l eN

π π π

π

− − −− −

= = =

− − −− −

= = =

=

=

∑ ∑ ∑

∑ ∑ ∑

Page 38: DSP-chap7 2010cwlin/courses/dsp/notes/DSP... · 2010. 6. 11. · 2 Before we introduce the DFT, we consider the sampling of the Fourier transform of an aperiodic discrete-time sequence

38

� The inner sum in the brackets in the above equation has the form

where is defined as

� We observe that when is a multiple of N.

2010/6/12 Introduction to Digital Signal Processing 75

Multiplication of Two DFTs and Circular Convolution

1

0

, 1

1, 1

1

Nk N

k

N a

a aa

a

=

=

= −≠ −

a 2 ( )/j m n l Na e π − −=

1a = m n l− −

� On the other hand, for any value of .

� Consequently, the above equation reduces to

� Then we obtain the desired expression for in the form

2010/6/12 Introduction to Digital Signal Processing 76

Multiplication of Two DFTs and Circular Convolution

1Na = 0a ≠

1

0

, (( )) , p an integer

0, otherwise

NNk

k

N l m n pN m na

=

= − + = −=

3( )x m

1

3 1 20

( ) ( ) (( )) , 0,1,..., 1N

Nn

x m x n x m n m N−

=

= − = −∑

Page 39: DSP-chap7 2010cwlin/courses/dsp/notes/DSP... · 2010. 6. 11. · 2 Before we introduce the DFT, we consider the sampling of the Fourier transform of an aperiodic discrete-time sequence

39

� Circular convolution . If

then

where denotes the circular convolution of the sequence .

2010/6/12 Introduction to Digital Signal Processing 77

Multiplication of Two DFTs and Circular Convolution

1 1 2 2( ) ( ) and ( ) ( )DFT DFTN N

x n X k x n X k←→ ←→

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

x n x n X k X k←→N

1 2( ) ( )x n x nN

1 2( ) and ( )x n x n

� Time reversal of a sequence . If

then

� Hence reversing the N-point sequence in time is equivalent to reversing the DFT values.

2010/6/12 Introduction to Digital Signal Processing 78

Additional DFT Properties

( ) ( )DFTN

x n X k←→

(( )) ( ) (( )) ( )DFTN NN

x n x N n X k X N k− = − ←→ − = −

Page 40: DSP-chap7 2010cwlin/courses/dsp/notes/DSP... · 2010. 6. 11. · 2 Before we introduce the DFT, we consider the sampling of the Fourier transform of an aperiodic discrete-time sequence

40

� Circular time shift of a sequence . If

then

� Circular frequency shift . If

2010/6/12 Introduction to Digital Signal Processing 79

Additional DFT Properties

( ) ( )DFTN

x n X k←→

2 /(( )) ( )DFT j kl NN N

x n l X k e π−− ←→

( ) ( )DFTN

x n X k←→

2 ln/( ) (( ))DFTj NNN

x n e X k lπ ←→ −

� Complex-conjugate properties . If

then

� The IDFT of is

therefore,

2010/6/12 Introduction to Digital Signal Processing 80

Additional DFT Properties

( ) ( )DFTN

x n X k←→

* * *( ) (( )) ( )DFTNN

x n X k X N k←→ − = −

1 1* 2 / 2 ( )/

0 0

1 1( ) ( )

N Nj kn N j k N n N

k k

X k e X k eN N

π π− −

= =

=

∑ ∑

* * *(( )) ( ) ( )DFTN N

x n x N n X k− = − ←→

* ( )X k

Page 41: DSP-chap7 2010cwlin/courses/dsp/notes/DSP... · 2010. 6. 11. · 2 Before we introduce the DFT, we consider the sampling of the Fourier transform of an aperiodic discrete-time sequence

41

� Circular correlation . If

then

where is the (unnormalized) circular crosscorrelation sequence, defined as

2010/6/12 Introduction to Digital Signal Processing 81

Additional DFT Properties

( ) ( ) and ( ) ( )DFT DFTN N

x n X k y n Y k←→ ←→

*( ) ( ) ( ) ( )DFTxy xyN

r l R k X k Y k←→ =��

1*

0

( ) ( ) (( ))N

xy Nn

r l x n y n l−

=

= −∑�

( )xyr l�

� Multiplication of two sequences . If

then

� Parseval’s Theorem . If

then

2010/6/12 Introduction to Digital Signal Processing 82

Additional DFT Properties

1 1 2 2( ) ( ) and ( ) ( )DFT DFTN N

x n X k x n X k←→ ←→

1 2 1 2

1( ) ( ) ( ) ( )DFT

Nx n x n X k X k

N←→ N

( ) ( ) and ( ) ( )DFT DFTN N

x n X k y n Y k←→ ←→1 1

* *

0 0

1( ) ( ) ( ) ( )

N N

n k

x n y n X k Y kN

− −

= =

=∑ ∑

Page 42: DSP-chap7 2010cwlin/courses/dsp/notes/DSP... · 2010. 6. 11. · 2 Before we introduce the DFT, we consider the sampling of the Fourier transform of an aperiodic discrete-time sequence

42

� The DFT provides a discrete frequency representation of a finite-duration sequence in the frequency domain, it explore its use as a computational tool for linear system analysis and, especially, for linear filtering.

� We have already established that a system with frequency response , when excited with an input signal that has a spectrum , possesses an output spectrum .

� The output sequence is determined from its spectrum via the inverse Fourier transform.

2010/6/12 Introduction to Digital Signal Processing 83

Linear Filtering Methods based on the DFT

( )H ω( )X ω

( ) ( ) ( )Y X Hω ω ω=

( )y n

� Suppose that we have a finite-duration sequence of length L which excites an FIR filter of length M. Without loss of generality, let

where is the impulse response of the FIR filter.

� The output sequence

2010/6/12 Introduction to Digital Signal Processing 84

Use of the DFT in Linear Filtering

( )x n

( ) 0, 0 and

( ) 0, 0 and

x n n n L

h n n n M

= < ≥

= < ≥

( )h n

1

0

( ) ( ) ( )M

k

y n h k x n k−

=

= −∑

Page 43: DSP-chap7 2010cwlin/courses/dsp/notes/DSP... · 2010. 6. 11. · 2 Before we introduce the DFT, we consider the sampling of the Fourier transform of an aperiodic discrete-time sequence

43

� The frequency-domain equivalent to the above is

� If

then

where are the N-point DFTs of the corresponding sequences .

2010/6/12 Introduction to Digital Signal Processing 85

Use of the DFT in Linear Filtering

( ) ( ) ( )Y X Hω ω ω=

2 /

2 /

( ) ( ) | , 0,1,..., 1

( ) ( ) | , 0,1,..., 1k N

k N

Y k Y k N

X H k Nω π

ω π

ω

ω ω=

=

≡ = −

= = −

( ) ( ) ( ), 0,1,..., 1Y k X k H k k N= = −

{ ( )} and { ( )}X k H k( ) and ( )x n h n

� In practical applications involving linear filtering of signals, the input sequence is often a very long sequence. This is especially true in some real-time signal processing applications concerned with signal monitoring and analysis.

� Since linear filtering performed via the DFT involves operations on a block of data, which by necessity must be limited in size due to limited memory of a digital computer, a long input signal sequence must be segmented to fixed-size blocks prior to processing.

2010/6/12 Introduction to Digital Signal Processing 86

Filtering of Long Data Sequences

( )x n

Page 44: DSP-chap7 2010cwlin/courses/dsp/notes/DSP... · 2010. 6. 11. · 2 Before we introduce the DFT, we consider the sampling of the Fourier transform of an aperiodic discrete-time sequence

44

Overlap-Add Method

2010/6/12 87Introduction to Digital Signal Processing

Overlap-Add Method

� We first segment x(n), assumed to be a causal sequence here without any loss of generality, into a set of contiguous finite-length subsequences of length L each:

where

� Thus we can write

where

� Since h(n) is of length M and xm(n) is of length L, ym(n) is of length L + M −1

2010/6/12 88Introduction to Digital Signal Processing

0

( ) ( )

( ), 0 1( )

0, otherwise

mm

m

x n x n mL

x n mL n Lx n

=

= −

+ ≤ ≤ −=

0

( ) ( ) ( ) ( )

( ) ( ) ( )

mm

m m

y n h n x n y n mL

y n h n x n

=

= ∗ = −

= ∗

Page 45: DSP-chap7 2010cwlin/courses/dsp/notes/DSP... · 2010. 6. 11. · 2 Before we introduce the DFT, we consider the sampling of the Fourier transform of an aperiodic discrete-time sequence

45

Overlap-Add Method

� The desired linear convolution y(n) = h(n) * x(n) is broken up into a sum of infinite number of short-length linear convolutions of length L + M −1 each: ym(n) = h(n) * xm(n)

� Consider implementing the following convolutions using the DFT-based method, where now the DFTs (and the IDFT) are computed on the basis of (L + M −1) points

� The first convolution in the above sum, y0(n) = h(n) * x0(n), is of length L + M −1 and is defined for 0 ≤ n ≤ L + M − 2

� The second short convolution y1[n] = h(n) *x1(n), is also of length L + M −1 but is defined for L ≤ n ≤ 3L + M − 2

� There is an overlap of samples between these two short linear convolutions

2010/6/12 89Introduction to Digital Signal Processing

0

( ) ( )mm

y n y n mL∞

=

= −∑

Overlap-Add Method

� In general, there will be an overlap of M −1 samples between the samples of the short convolutions h(n) * xr-1(n) and h(n) * xm(n) for (r −1)L ≤ n ≤ rL + M − 2

2010/6/12 90Introduction to Digital Signal Processing

Page 46: DSP-chap7 2010cwlin/courses/dsp/notes/DSP... · 2010. 6. 11. · 2 Before we introduce the DFT, we consider the sampling of the Fourier transform of an aperiodic discrete-time sequence

46

Overlap-Add Method

� Therefore, y(n) obtained by a linear convolution of x(n) and h(n) is given by

2010/6/12 91Introduction to Digital Signal Processing

0

1 1

1

( ) ( ), 0 6

( ) ( ) ( 7), 7 10

( ) ( 7), 11 13

y n y n n

y n y n y n n

y n y n n

= ≤ ≤

= + − ≤ ≤

= − ≤ ≤

Overlap-Add Method

� The above procedure is called the overlap-add method since the results of the short linear convolutions overlap and the overlapped portions are added to get the correct final result

� The MATLAB function fftfilt can be used to implement the above method

� The following illustrates an example of filtering of a noise-corrupted signal using a length-3 moving average filter:

2010/6/12 92Introduction to Digital Signal Processing

Page 47: DSP-chap7 2010cwlin/courses/dsp/notes/DSP... · 2010. 6. 11. · 2 Before we introduce the DFT, we consider the sampling of the Fourier transform of an aperiodic discrete-time sequence

47

Overlap-Save Method

2010/6/12 93Introduction to Digital Signal Processing

Overlap-Save Method

� In implementing the overlap-add method using the DFT, we need to compute two (L + M −1)-point DFTs and one (L + M−1)-point IDFT for each short linear convolution

� It is possible to implement the overall linear convolution by performing instead circular convolution of length shorter than (L + M −1)

� To this end, it is necessary to segment x(n) into overlapping blocks xm(n), keep the terms of the circular convolution of h(n) with that corresponds to the terms obtained by a linear convolution of h(n) and xm(n), and throw away the other parts of the circular convolution

2010/6/12 94Introduction to Digital Signal Processing

Page 48: DSP-chap7 2010cwlin/courses/dsp/notes/DSP... · 2010. 6. 11. · 2 Before we introduce the DFT, we consider the sampling of the Fourier transform of an aperiodic discrete-time sequence

48

Overlap-Save Method

� To understand the correspondence between the linear and circular convolutions, consider a length-4 sequence x(n) and a length-3 sequence h(n)

� Let yL(n) denote the result of a linear convolution of x(n) with h(n)

� The six samples of yL(n) are given byyL(0) = h(0)x(0)yL(1) = h(0)x(1) + h(1)x(0)yL(2) = h(0)x(2) + h(1)x(1) + h(2)x(0)yL(3) = h(0)x(3) + h(1)x(2) + h(2)x(1)yL(0) = h(1)x(3) + h(2)x(2)yL(5) = h(2)x(3)

2010/6/12 95Introduction to Digital Signal Processing

Overlap-Save Method

� If we append h(n) with a single zero-valued sample and convert it into a length-4 sequence he(n), the 4-point circular convolution Yc(n) of he(n) and x(n) is given by

yC(0) = h(0)x(0) + h(1)x(3) + h(2)x(2)yC(1) = h(0)x(1) + h(1)x(0) + h(2)x(3)yC(2) = h(0)x(2) + h(1)x(1) + h(2)x(0)yC(3) = h(0)x(3) + h(1)x(2) + h(2)x(1)

� If we compare the expressions for the samples yL(n) of with those of yC(n), we observe that the first 2 terms of yC(n) do not correspond to the first 2 terms of yL(n), whereas the last 2 terms of yC(n) are precisely the same as the 3rd and 4th terms of yL(n), i.e.

yL(0) ≠ yC(0), yL(1) ≠ yC(1), yL(2) = yC(2), yL(3) = yC(3)

2010/6/12 96Introduction to Digital Signal Processing

Page 49: DSP-chap7 2010cwlin/courses/dsp/notes/DSP... · 2010. 6. 11. · 2 Before we introduce the DFT, we consider the sampling of the Fourier transform of an aperiodic discrete-time sequence

49

Overlap-Save Method

� General case : N-point circular convolution of a length-M sequence h(n) with a length-L sequence x(n) with N > M

� First M − 1 samples of the circular convolution are incorrect and are rejected

� Remaining L − M + 1 samples correspond to the correct samples of the linear convolution of h(n) with x(n)

� Now, consider an infinitely long or very long sequence x(n)� Break it up as a collection of smaller length (length-4)

overlapping sequences xm(n) as xm(n) = x(n + 2m), 0 ≤ n ≤ 3, 0 ≤ m ≤ ∞

� Next, form

2010/6/12 97Introduction to Digital Signal Processing

( ) ( ) ( )m mw n h n x n= 4

Overlap-Save Method

� Or, equivalently, wm(0) = h(0)xm(0) + h(1)xm(3) + h(2)xm(2)wm(1) = h(0)xm(1) + h(1)xm(0) + h(2)xm(3)wm(2) = h(0)xm(2) + h(1)xm(1) + h(2)xm(0)wm(3) = h(0)xm(3) + h(1)xm(2) + h(2)xm(1)

� Computing the above for m = 0, 1, 2, 3, . . . , and substituting the values of xm[n] we arrive at

w0(0) = h(0)x(0) + h(1)x(3) + h(2)x(2) � Rejectw0(1) = h(0)x(1) + h(1)x(0) + h(2)x(3) � Rejectw0(2) = h(0)x(2) + h(1)x(1) + h(2)x(0) = y[2] � Savew0(3) = h(0)x(3) + h(1)x(2) + h(2)x(1) = y[3] � Save

2010/6/12 98Introduction to Digital Signal Processing

Page 50: DSP-chap7 2010cwlin/courses/dsp/notes/DSP... · 2010. 6. 11. · 2 Before we introduce the DFT, we consider the sampling of the Fourier transform of an aperiodic discrete-time sequence

50

Overlap-Save Method

w1(0) = h(0)x(2) + h(1)x(5) + h(2)x(4) � Rejectw1(1) = h(0)x(3) + h(1)x(2) + h(2)x(5) � Rejectw1(2) = h(0)x(4) + h(1)x(3) + h(2)x(2) = y(4) � Savew1(3) = h(0)x(5) + h(1)x(4) + h(2)x(3) = y(5) � Save

w2(0) = h(0)x(4) + h(1)x(7) + h(2)x(6) � Rejectw2(1) = h(0)x(5) + h(1)x(4) + h(2)x(7) � Rejectw2(2) = h(0)x(6) + h(1)x(5) + h(2)x(4) = y(6) � Savew2(3) = h(0)x(7) + h(1)x(6) + h(2)x(5) = y(7) � Save

� It should be noted that to determine y(0) and y(1), we need to form x−1(n): x−1(0) = 0, x−1(1) = 0, x−1(2) = x(0) , x−1(3) = x(1) and compute w−1(n) = h(n) 4 x−1(n) for 0 ≤ n ≤ 3, reject w−1(0) and w−1(1), and save w−1(2) = y(0), and w−1(3) = y(1)

2010/6/12 99Introduction to Digital Signal Processing

Overlap-Save Method

� General Case : Let h(n) be a length-L sequence� Let xm(n) denote the m-th section of an infinitely long

sequence x[n] of length L and defined byxm(n) = x(n + m(L − m + 1)), 0 ≤ n ≤ L − 1 with M < L

� Let wm(n) = h(n) xm(n)� Then, we reject the first M − 1 samples of wm(n) and “abut”

the remaining L − M + 1 samples of wm(n) to form yL(n), the linear convolution of h(n) and x(n)

� If ym[n] denotes the saved portion of wm(n), i.e.,

� Then yL(n + m(L − M + 1)) = ym(n), M − 1 ≤ n ≤ l − 1

2010/6/12 100Introduction to Digital Signal Processing

0, 0 2( )

( ), -1 2m

n My n

w n M n L

≤ ≤ −=

≤ ≤ −

Page 51: DSP-chap7 2010cwlin/courses/dsp/notes/DSP... · 2010. 6. 11. · 2 Before we introduce the DFT, we consider the sampling of the Fourier transform of an aperiodic discrete-time sequence

51

Overlap-Save Method

� The approach is called overlap-save method since the input is segmented into overlapping sections and parts of the results of the circular convolutions are saved and abutted to determine the linear convolution result

2010/6/12 101Introduction to Digital Signal Processing

Overlap-Save Method

2010/6/12 102Introduction to Digital Signal Processing

Page 52: DSP-chap7 2010cwlin/courses/dsp/notes/DSP... · 2010. 6. 11. · 2 Before we introduce the DFT, we consider the sampling of the Fourier transform of an aperiodic discrete-time sequence

52

� Let denote the sequence to be analyzed. Limiting the duration of the sequence to L samples, in the interval

, is equivalent to multiplying by a rectangular window of length L. That is

where

2010/6/12 Introduction to Digital Signal Processing 103

Frequency Analysis of Signals Using the DFT

{ ( )}x n

0 1n L≤ ≤ − { ( )}x n( )w n

ˆ( ) ( ) ( )x n x n w n=

1, 0 1( )

0, otherwise

n Lw n

≤ ≤ −=

� Suppose that the sequence consists of a signal sinusoid, that is

� Then the Fourier transform of the finite-duration sequence can be expresses as

where is the Fourier transform of the window sequence, which is

2010/6/12 Introduction to Digital Signal Processing 104

Frequency Analysis of Signals Using the DFT

( )x n

0( ) cosx n nω=

( )x n

0 0

1ˆ ( ) [ ( ) ( )]2

X W Wω ω ω ω ω= − + +

( )W ω

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

sin( / 2)j LL

W e ωωω

ω− −=

Page 53: DSP-chap7 2010cwlin/courses/dsp/notes/DSP... · 2010. 6. 11. · 2 Before we introduce the DFT, we consider the sampling of the Fourier transform of an aperiodic discrete-time sequence

53

� Magnitude spectrum for L=25 and N=2048, illustrating the occurrence of leakage.

2010/6/12 Introduction to Digital Signal Processing 105

Frequency Analysis of Signals Using the DFT

2010/6/12 Introduction to Digital Signal Processing 106

Frequency Analysis of Signals Using the DFT

0 1 2( ) cos cos cosx n n n nω ω ω= + +

Page 54: DSP-chap7 2010cwlin/courses/dsp/notes/DSP... · 2010. 6. 11. · 2 Before we introduce the DFT, we consider the sampling of the Fourier transform of an aperiodic discrete-time sequence

54

Signal Transform

• Motivation: – Represent a vector (e.g. a block of image samples) as

the superposition of some typical vectors (block patterns)

+t1 t2 t3 t4

2010/6/12 107Introduction to Digital Signal Processing

Transform Coding of a Image

2010/6/12 108Introduction to Digital Signal Processing

Page 55: DSP-chap7 2010cwlin/courses/dsp/notes/DSP... · 2010. 6. 11. · 2 Before we introduce the DFT, we consider the sampling of the Fourier transform of an aperiodic discrete-time sequence

55

1-D 16-Pont DFT Basis Vectors

2010/6/12 109Introduction to Digital Signal Processing

Disadvantages of DFT in Signal Coding

• Fourier Transform of a real function results incomplex numbers

• May result in artifacts due to discontinuityat the block boundary

Discontinuities (high freq. components)

2010/6/12 110Introduction to Digital Signal Processing

Page 56: DSP-chap7 2010cwlin/courses/dsp/notes/DSP... · 2010. 6. 11. · 2 Before we introduce the DFT, we consider the sampling of the Fourier transform of an aperiodic discrete-time sequence

56

From DFT to DCT

• DFT of any real and symmetric sequence contains only real coefficients corresponding to the cosine terms of the series

• Construct a new symmetric sequence y(n) of length 2N out of x(n) of length N

• Y(n) is symmetrical about n = N - (1/2)

= ≤ ≤ −

= − − ≤ ≤ −

( ) ( ),0 1,

( ) (2 1 ), 2 1.

y n x n n N

y n x N n N n N

2010/6/12 111Introduction to Digital Signal Processing

From DFT to DCT

• DCT has a higher compression ration than DFT• DCT avoids the generation of spurious spectral

components

No discontinuities

2010/6/12 112Introduction to Digital Signal Processing

Page 57: DSP-chap7 2010cwlin/courses/dsp/notes/DSP... · 2010. 6. 11. · 2 Before we introduce the DFT, we consider the sampling of the Fourier transform of an aperiodic discrete-time sequence

57

From DFT to DCT

− +

=

− −+ +

= =

=

= +

∑ ∑

12 1 ( )2

20

1 11 2 1( ) ( )2 2

2 20

( ) ( ) ,

( ) ( )

N n k

Nn

N Nn k n k

N Nn n N

Y k y n W

y n W y n W

π

π

− −+ +

= =

− −+ − +

= =

=

= + − −

= +

+=

≤ ≤ − =

∑ ∑

∑ ∑

1 11 2 1( ) ( )2 2

2 20

1 11 1( ) [ 2 ( ) ]2 2

2 20 0

1

0

22

2

( ) ( 2 1 )

( ) ( )

( 2 1)2 ( ) c o s ,

2

0 2 1,

N Nn k n k

N Nn n N

N Nn k N n k

N Nn n

N

n

jN

N

x n W x N n W

x n W x n W

n kx n

N

k N a n d W e

2010/6/12 113Introduction to Digital Signal Processing

1-D N-Point DCT

π

π

=

=

+ =

= −

+ = = −

1

0

1

0

( 2 1)( ) ( ) ( ) c o s ,

2

0 ,1, , 1,

( 2 1)( ) ( ) ( ) c o s ,

2

0 ,1, , 1,

N

n

N

k

n kF k C k f n

N

k N

n kf n C k F k

N

n N

= = = −�1 2

(0) , ( ) , 1,2, , 1C C k k NN N

where

• The constants are often defined differently

2010/6/12 114Introduction to Digital Signal Processing

Page 58: DSP-chap7 2010cwlin/courses/dsp/notes/DSP... · 2010. 6. 11. · 2 Before we introduce the DFT, we consider the sampling of the Fourier transform of an aperiodic discrete-time sequence

58

1-D N-Point DCT

( )cos (2 1)0 /16n π+

( )cos (2 1)1 /16n π+

( )cos (2 1)2 /16n π+

( )cos (2 1)3 /16n π+

( )cos (2 1)4 /16n π+

( )cos (2 1)5 /16n π+

( )cos (2 1)6 /16n π+

( )cos (2 1)7 /16n π+

2010/6/12 115Introduction to Digital Signal Processing

Example of 1-D DCT

0.00 200.00 400.00 600.00

0.00

40.00

80.00

120.00

160.00

200.00Row 256 of Lena

0.00 200.00 400.00 600.00

0.00

500.00

1000.00

1500.00

2000.00

2500.00

absolute DCT values of Lena row 256

2010/6/12 116Introduction to Digital Signal Processing

Page 59: DSP-chap7 2010cwlin/courses/dsp/notes/DSP... · 2010. 6. 11. · 2 Before we introduce the DFT, we consider the sampling of the Fourier transform of an aperiodic discrete-time sequence

59

Illustration of Image Coding Using 2-D DCT

2010/6/12 117Introduction to Digital Signal Processing

DCT-Based Image Coding with Different Quantization Levels

• DCT coding with increasingly coarse quantization, block size 8x8

quantizer step-size for AC coefficient: 25

quantizer step-size for AC coefficient: 100

quantizer step-size for AC coefficient: 200

2010/6/12 118Introduction to Digital Signal Processing

Page 60: DSP-chap7 2010cwlin/courses/dsp/notes/DSP... · 2010. 6. 11. · 2 Before we introduce the DFT, we consider the sampling of the Fourier transform of an aperiodic discrete-time sequence

60

Image Coding with Different Numbers of DCT Coefficients

original

with 8/64 coefficients

with 4/64 coefficients

with 16/64 coefficients

2010/6/12 119Introduction to Digital Signal Processing

DCT-Based Coding: JPEG

8x8 blocks

Entropyencoder

Compressedimage data

QDPCM

Zigzagscan

Quantizationtable

Tablespecification

Entropydecoder

Compressedimage data

IQDPCM

Zigzagscan

Quantizationtable

Tablespecification

Sourceimage data

Reconstructedimage data

DCTAC

DC

8x8 blocks

IDCT

DC

AC

2010/6/12 120Introduction to Digital Signal Processing