Digital Signal Processing Chapter 3 Discrete transforms

Preview:

Citation preview

Digital Signal Processing

Chapter 3

Discrete transforms

2

2.1 Introduction

• Up to now, we have converted analog signals into discrete-time sequences. So now we can process these sequences by computers. But we cannot process the spectra, i.e., Fourier transforms, in digital way, because they are continuous.

• In order for that the signals can be processed by computers in the discrete-frequency domain, we should sample the continuous-frequency Fourier transforms, to obtain the discrete-frequency Fourier transforms.

3

3.2 Discrete Fourier transform

• Sampling X(z) at |z| =1, the discrete Fourier transform can be obtained.

N

2

]Re[z

]Im[zj

4

3.2 Discrete Fourier transform

The continuous-frequency Fourier transform X(ejω) is sampled by an impulse train as follows

This sampling process can be described as

According to the convolution theorem, we get that

k

kN

2

k

jj kN

eXeX 2

)()(

k

j kN

nxeXnx 2

)()()( 11 FF

5

3.2 Discrete Fourier transform

p

N

k

N

N

nj

N

N

njN

k

N

N

nj

kk

pNnN

pNnN

dekN

dekN

dekN

kN

)(2

otherwise,0

,2

2

2

1

2

2

1

2

2

12

1

0

2

2 1

0

21

F

6

3.2 Discrete Fourier transform

This expression shows that, after sampling the continuous-frequency Fourier transform, the sequence becomes periodic. is a precise periodic shifted repetition of x(n).

p

p

k

j

pNnxN

pNnN

nx

kN

nxeXnx

)(2

)(2

)(

2)()()( 11

FF

)(nx

7

3.2 Discrete Fourier transform

• For a finite length sequence, its Fourier transform can be represented by the samples in frequency.

• Only if the number of samples, N, of the Fourier transform in one period is larger than or equal to the length of the sequence, can represent x(n) utterly.)(nx

10for ),(2

)( NnnxN

nx

8

3.2 Discrete Fourier transform

0 2

)( jeH

0 2

0 2

)( jeH

0 n

)(nx

0

0 n

)(nx

n

9

3.2 Discrete Fourier transform

10for )(1

)(2

)(

)(2

1

2)(

2

1

)(2

1)(

2)(

2)()(

1

0

22

1

0

22

22

2

2

NneeXN

nxN

nx

eeX

dekN

eX

deeXnx

kN

eXkN

eXeX

N

k

knN

jkN

j

N

k

knN

jkN

j

N

N

nj

k

kN

j

N

N

njj

k

kN

j

k

jj

10

3.2 Discrete Fourier transform

• The expression

shows that a finite-length sequence can be obtained from the samples of its Fourier transform.

This expression is referred to as the inverse discrete Fourier transform, IDFT for short.

10for ,)(1

)(2

)(1

0

22

NneeXN

nxN

nxN

k

knN

jkN

j

11

3.2 Discrete Fourier transform

0 2

)( jeH

0 2

)( jeH

0 n

)(nx

0 n

)(nx

0 2

)( jeH

0 n

)(nx

12

3.2 Discrete Fourier transform

• The Fourier transform X(ejω), after sampled, is defined as the discrete Fourier transform,that is

10for ),(

)(

)()(

2

1

0

2

2

1

02

NkeX

enx

enxeX

kN

j

N

n

knN

j

kN

N

n

nj

kN

j

13

3.2 Discrete Fourier transform

1

0

)1(2

2

1

02

2

1

0

1

0

22

1

0

1

0

221

0

2sin

2sin

)(1

1

1)(

1

)(1

)(1

)()(

N

k

NN

kjk

Nj

N

k kN

j

NjkN

j

N

k

N

n

nkN

jkN

j

N

n

njN

k

knN

jkN

jN

n

njj

e

Nk

kN

eXN

e

eeX

N

eeXN

eeeXN

enxeX

14

3.2 Discrete Fourier transform

• Usually, the simplified notation is used, that is

10for ,)(1

)(

10for ,)()(

1

0

2

1

0

2

NnekXN

nx

NkenxkX

N

n

knN

j

N

n

knN

j

15

3.2 Discrete Fourier transform

• Furthermore, let

we get the canonical form of discrete Fourier transforms, that is

Nj

N eW2

10for ,)(1

)(

10for ,)()(

1

0

1

0

NnWkXN

nx

NkWnxkX

N

n

knN

N

n

knN

16

3.2 Discrete Fourier transform

a finite-length sequence with length N: x(n)

a periodic sequence with period N: )(nx

the Fourier transform of x(n): X(ejω)

the Fourier transform of : )(nx )( jeX

sampling

FT

IFTtaking one period

DFStaking one period

a finite-length sequence with length N: x(n)

taking one period

DFT

The discrete Fourier transform of x(n): X(k)

17

Example 1

Compute the DFT of the following sequence

Solution

96,0

50,1)(

n

nnx

k

ke

e

eekX

kj

kj

kj

n

knj

10sin

53

sin

1

1)( 2

10

2

610

25

0

10

2

18

Example 1 (cont.)

0

6

0 k

|H(k)|

0

–π

–π/2

π/2

π

4

2

1 2 3 4 5 6 7 8 9

k0 1 2 3 4 5 6 7 8 9

arg[H(k)]

19

Example 2

Compute the DFT of the following sequence

Solution

95,1

40,1)(2 n

nnx

0)0(

1

)1(2

11

1)(

2

10

510

10

1010

510

10

510

9

510

4

0102

X

W

W

W

WW

W

WWWkX

k

k

k

kk

k

k

n

kn

n

kn

20

Example 3

Compute the DFT of the following sequence

Solution

95,0

40,2)(3 n

nnx

10)0(

1

)1(2

1

122)(

3

10

510

10

510

4

0103

X

W

W

W

WWkX

k

k

k

k

n

kn

21

Comparison between Ex. 2 and Ex. 3

)(2jeX

)(3jeX

0 2

0 1 2 3 4 5 6 7 8 9k

22

Matrix notation of discrete Fourier transform

)1(

)2(

)1(

)0(

1

)1(

)2(

)1(

)0(

)1(

)2(

)1(

)0(

)1(

)2(

)1(

)0(

2

2

)1()1(2)1(0

)1(2420

)1(210

0000

)1()1(2)1(0

)1(2420

)1(210

0000

NX

X

X

X

WWWW

WWWW

WWWW

WWWW

N

Nx

x

x

x

Nx

x

x

x

WWWW

WWWW

WWWW

WWWW

NX

X

X

X

NN

NN

NNN

NNNNN

NNNNN

NNNN

NN

NN

NNN

NNNNN

NNNNN

NNNN

23

3.3 Properties of the DFT

• Linearity

If x(n) = k1x1(n) + k2x2(n), then

X(k) = k1X1(k) + k2X2(k)

Note that the two sequences and two DFTs must have the same length.

24

3.3 Properties of the DFT

• Time-reversal

If x(n) ↔ X(k), then

x((– n) mod N) ↔ X ((–k) mod N)

x(n)

n

x(– n)

n

x((– n) mod N)

n

25

3.3 Properties of the DFT

• Time-shift theorem

Note that the sequence x(n+l) should be considered as a circular shift of x(n).

)()mod)(( kXWNlnx lkN

x(n)

n

x((n–2) mod N)

n

26

3.3 Properties of the DFT

• Circular frequency-shift theorem (modulation theorem)

Note that the DFT X(k+l) should also be considered as a circular shift of X(k).

From

we get that

)mod)(()( NlkXnxW nlN

nl

Njnl

NW nl

N

2sin

2cos

)mod)(()mod)(((2

12sin)(

)mod)(()mod)(((2

12cos)(

NlkXNlkXnlN

nx

NlkXNlkXnlN

nx

27

3.3 Properties of the DFT

• Circular convolution in time

)()()()()()()()(

)()(),()(

10for ,)mod()mod)((

)mod)(()mod()(

1

0

1

0

kYkHkXnxnhnhnxny

kHnhkXnx

NnNlhNlnx

NlnhNlxny

N

l

N

l

28

3.3 Properties of the DFT

Proof

1

0

1

0

1

0

1

0

1

0

1

0

1

0

)mod)(()(

)(1

)(

)()(1

)()(1

)(1

)(

N

l

N

l

N

k

klN

knN

N

k

knN

N

l

klN

N

k

knN

N

k

knN

Nlnhlx

WWkHN

lx

WkHWlxN

WkHkXN

WkYN

ny

29

Example 1

Compute the 6 point circular convolution.

Solution

}2,3,4,1{)(},1,3,2,1{)(

)()()(

nhnx

nhnxny

9)5(143200)6mod)5((

17)4(014320)6mod)4((

21)3(001432)6mod)3((

14)2(200143)6mod)2((

6)1(320014)6mod)1((

3)0(432001)6mod)0((

001321)(

ylh

ylh

ylh

ylh

ylh

ylh

lx

30

Example 1 (cont.)

The 6 point circular convolution is

Now, let’s see the linear convolution.

}9,17,21,14,6,3{)()()( nhnxny

2)6(1432)6(

9)5(1432)5(

17)4(1432)4(

21)3(1432)3(

14)2(1432)2(

6)1(1432)1(

1)0(1432)0(

1321)(

ylh

ylh

ylh

ylh

ylh

ylh

ylh

lx

31

Example 1 (cont.)

The 6 point circular convolution is

and the linear convolution is

Comparison between the circular and the linear.– Usually, two convolutions are different from each other;

– The circular one is the periodic repetition of the linear one.

– In a certain condition, two convolutions could be the same, that is, the period N is greater than or equal to the length of the linear convolution.

}9,17,21,14,6,3{)()()( nhnxny

}2,9,17,21,14,6,1{)()()( nhnxny

32

3.3 Properties of the DFT

• Circular correlation

The DFT of the correlation in time between two sequences is such that

• Circular autocorrelation

)mod)(()()mod)(()(1

0

NkHkXNlnhnxN

n

)mod)(()()mod)(()(1

0

NkXkXNlnxnxN

n

33

3.3 Properties of the DFT

• Real and imaginary sequences– If x(n) is a real sequence, then

Re[X(k)] = Re[X((–k) mod N)]

Im[X(k)] = – Im[X((–k) mod N)]

– If x(n) is an imaginary sequence, then

Re[X(k)] = – Re[X((–k) mod N)]

Im[X(k)] = Im[X((–k) mod N)]

– If x(n) is a real or an imaginary sequence, then

|X(k)| = |X((–k) mod N)|

arg[X(k)] = – arg[X((–k) mod N)]

34

3.3 Properties of the DFT

• Symmetric and antisymmetric sequences– If x(n) = x*((–n) mod N), it is a periodically conjugate symmet

ric sequence;

– If x(n) = – x*((–n) mod N), it is a periodically conjugate antisymmetric.

Periodically conjugate symmetric and antisymmetric sequences have the following properties:– If x(n) is conjugate symmetric, X(k) is real;

– If x(n) is conjugate antisymmetric, X(k) is imaginary;

35

3.3 Properties of the DFT

• Parseval’s theorem

1

0

21

0

2)(

1)(

N

n

N

n

kXN

nx

36

3.3 Properties of the DFT

• Relation between the DFT and z transform

– Sampling the z transform at , we can obtain the DFT.

– The z transform can be obtained from the DFT.

kN

2

1

01

1

01

1

0

1

0

1

0

1

0

1

0

1

)(1

1

1)(

1)(

1

)(1

)()(

N

kk

N

N

N

kk

N

NkNN

N

k

N

n

nknN

N

n

nN

k

knN

N

n

n

zW

kX

N

z

zW

zWkX

NzWkX

N

zWkXN

znxzX

37

3.4 Digital filtering using the DFT

• Linear and circular convolutions

Assume that x(n) has duration L and h(n) has duration K. For the linear convolution , the duration of y(n) is L + K –1.

If the convolution size N satisfies the condition

N ≥ L + K –1

then the circular convolution is equivalent to the linear convolution.

)()()( nhnxny

38

3.4 Digital filtering using the DFT

• Overlap-and-add method

…x(n)

L L Lh(n)

K

L+K–1

L+K–1

L+K–1

y(n)

39

3.4 Digital filtering using the DFT

• Overlap-and-save method

x(n)

h(n)

L+K–1

y(n)

K

L

saveddiscarded

K–1

40

3.5 Fast Fourier transform (FFT)

• Algorithm analysis of DFT

When computing the DFT of an N-point sequence, we need about N2 complex multiplications and N2 complex additions.

In early 1960s, Cooley and Tukey proposed the fast Fourier transform, which requires the order of Nlog2N.

10for ,)(1

)(

10for ,)()(

1

0

1

0

NnWkXN

nx

NkWnxkX

N

n

knN

N

n

knN

41

3.5.1 Radix-2 decimation-in-time algorithm

Separating x(n) into its even- and odd-numbered points, we obtain that

or with n=2r for n even and n=2r+1 for n odd,

1

odd0

1

even0

1

0

)()()()(N

nn

knN

N

nn

knN

N

n

knN WnxWnxWnxkX

1)2(

0

21)2(

0

2

1)2(

0

)12(1)2(

0

2

))(12())(2(

)12()2()(

N

r

rkN

kN

N

r

rkN

N

r

krN

N

r

rkN

WrxWWrx

WrxWrxkX

42

3.5.1 Radix-2 decimation-in-time algorithm

If we note that

for N even, then we have that

An N-point DFT can be broken into two (N/2)-point computations.

2)2(

2222

NN

jN

j

N WeeW

1)2(

02

1)2(

02

1)2(

0

21)2(

0

2

)12()2(

))(12())(2()(

N

r

rkN

kN

N

r

rkN

N

r

rkN

kN

N

r

rkN

WrxWWrx

WrxWWrxkX

43

3.5.1 Radix-2 decimation-in-time algorithm

• Algorithm analysis

Computing this DFT, we need

complex multiplications and

complex additions.

1)2(

02

1)2(

02 )12()2()(

N

r

rkN

kN

N

r

rkN WrxWWrxkX

NN

NN

222

22

222

22NN

44

3.5.1 Radix-2 decimation-in-time algorithm

• If N is equal to a power of 2, we can go on to break two (N/2)-point DFTs into four (N/4)-point DFTs.

• And repeat this procedure till the computation is reduced to N one point DFTs.

• For N=2r, where r is an integer, the procedure of decomposition can be done at most r =log2N times.

45

3.5.1 Radix-2 decimation-in-time algorithm

• Algorithm analysis once more– When an N-point DFT is broken into two (N/2)-point DFTs, N

2 multiplications are decreased to 2(N/2)2+N multiplications;

– When an (N/2)-point DFT is decomposed into two (N/4)-point DFTs, (N/2)2 decreases to 2(N/4)2+ N/2, so the overall computation needs 2[2(N/4)2+ N/2]+N = 4(N/4)2+2N complex multiplications ;

– After carrying out this procedure to the last, we actually accomplish the decompositions r =log2N times. At this time, the computation requires Nlog2N multiplications.

46

3.5.1 Radix-2 decimation-in-time algorithm

x(0)

x(2)

x(4)

x(6)

x(1)

x(3)

x(5)

x(7)

X(1)

X(2)

X(3)

X(4)

X(5)

X(6)

X(7)

4-pointDFT

4-pointDFT

0NW

1NW

2NW

3NW

4NW

5NW

6NW

7NW

X(0)

47

3.5.1 Radix-2 decimation-in-time algorithm

x(0)

x(6)

x(2)

x(4)

x(1)

x(5)

x(3)

x(7)

X(1)

X(2)

X(3)

X(4)

X(5)

X(6)

X(7)

0NW

1NW

2NW

3NW

4NW

5NW

6NW

7NW

X(0)2-pointDFT

0NW

2NW

4NW

6NW

0NW

2NW

4NW

6NW

2-pointDFT

2-pointDFT

2-pointDFT

48

3.5.1 Radix-2 decimation-in-time algorithm

x(0)

x(6)

x(2)

x(4)

x(1)

x(5)

x(3)

x(7)

X(1)

X(2)

X(3)

X(4)

X(5)

X(6)

X(7)

0NW

1NW

2NW

3NW

4NW

5NW

6NW

7NW

X(0)0

NW

2NW

4NW

6NW

0NW

2NW

4NW

6NW

0NW

4NW

0NW

4NW

0NW

4NW

0NW

4NW

49

3.5.1 Radix-2 decimation-in-time algorithm

• Basic butterfly computation

lNW

2

Nl

NW

)( pX m

)(qX m

)(1 pX m

)(1 qX m

)()()(

)()()(

21

1

qXWpXqX

qXWpXpX

m

Nl

Nmm

ml

Nmm

)()()(

)()()(

1

1

qXWpXqX

qXWpXpX

ml

Nmm

ml

Nmm

lNW 1

)( pX m

)(qX m

)(1 pX m

)(1 qX m

50

3.5.1 Radix-2 decimation-in-time algorithm

x(0)

x(2)

x(4)

x(6)

x(1)

x(5)

x(3)

x(7)

X(1)

X(2)

X(3)

X(4)

X(5)

X(6)

X(7)

1NW

3NW

X(0)

0NW 1

1

1

1

0NW

2NW

0NW

2NW

1

1

1

1

0NW

2NW

1

1

1

1

0NW

0NW

0NW

51

3.5.1 Radix-2 decimation-in-time algorithm

• Several characteristics of decimation-in-time algorithm– In-place

– Bit-reversed ordering

lNW 1

)( pX m

)(qX m

)(1 pX m

)(1 qX m

)7()111()111()7(

)6()110()011()3(

)5()101()101()5(

)4()100()001()1(

)3()011()110()6(

)2()010()010()2(

)1()001()100()4(

)0()000()000()0(

XXxx

XXxx

XXxx

XXxx

XXxx

XXxx

XXxx

XXxx

)(

)(

0

01

11

11

)(

)(

1

1

)(

)(

1

1

qX

pX

W

qX

pX

W

W

qX

pX

m

ml

N

m

m

lN

lN

m

m

52

3.5.2 Decimation-in-frequency algorithm

Dividing X(k) into smaller parts, we can get another class of FFT algorithms.

1)2(

0

2

1)2(

0

21)2(

0

1)2(

0

21)2(

0

1

2

1)2(

0

1

0

2)(

2)(

2)(

)()()()(

N

n

nkN

kN

N

N

n

nkN

kN

N

N

n

nkN

N

n

kN

n

N

N

n

nkN

N

Nn

nkN

N

n

nkN

N

n

nkN

WN

nxWnx

WN

nxWWnx

WN

nxWnx

WnxWnxWnxkX

53

3.5.2 Decimation-in-frequency algorithm

Now consider k even and k odd separately, that is

1)2(

0

1)2(

0

2

2)1()(

2)()(

N

n

nkN

k

N

n

nkN

kN

N

WN

nxnx

WN

nxWnxkX

1)2(

0

)12(

1)2(

0

2

2)()12(

2)()2(

N

n

nrN

N

n

nrN

WN

nxnxrX

WN

nxnxrX

54

3.5.2 Decimation-in-frequency algorithm

An N-point DFT X(k) can be divided into two (N/2)-point DFTs.

Repeat this procedure till an N-point DFT X(k) is divided into N one-point DFTs.

1)2(

0

2

1)2(

0

2

2)()12(

2)()2(

N

n

rnN

nN

N

n

rnN

WWN

nxnxrX

WN

nxnxrX

55

3.5.2 Decimation-in-frequency algorithm

X(2)

X(4)

X(6)

X(1)

X(3)

X(5)

X(7)

0NW

1NW

2NW

3NW

X(0)x(0)

x(1)

x(2)

x(3)

x(4)

x(5)

x(6)

x(7)

1

1

1

1

4-pointDFT

4-pointDFT

56

3.5.2 Decimation-in-frequency algorithm

X(4)

X(2)

X(6)

X(1)

X(5)

X(3)

X(7)

X(0)x(0)

x(1)

x(2)

x(3)

x(4)

x(5)

x(6)

x(7)

2-pointDFT

2-pointDFT

2-pointDFT

2-pointDFT

0NW

1NW

2NW

3NW

1

1

1

1

1

1

1

1

0NW

2NW

0NW

2NW

57

3.5.2 Decimation-in-frequency algorithm

X(4)

X(2)

X(6)

X(1)

X(5)

X(3)

X(7)

X(0)x(0)

x(1)

x(2)

x(3)

x(4)

x(5)

x(6)

x(7)

0NW

1NW

2NW

3NW

1

1

1

1

1

1

1

1

0NW

2NW

0NW

2NW

1

1

1

1

0NW

0NW

0NW

0NW

58

3.5.3 Radix-4 algorithm

When N=4l, we can divide an N-point DFT into four (N/4)-point DFTs.

1)4(

0

431)4(

0

42

1)4(

0

41)4(

0

4

1)4(

0

)34(1)4(

0

)24(

1)4(

0

)14(1)4(

0

4

)34()24(

)14()4(

)34()24(

)14()4()(

N

r

rkN

kN

N

r

rkN

kN

N

r

rkN

kN

N

r

rkN

N

r

krN

N

r

krN

N

r

krN

N

r

rkN

WrxWWrxW

WrxWWrx

WrxWrx

WrxWrxkX

59

3.5.3 Radix-4 algorithm

0NW

rNW

rNW 2

rNW 3

j1 j

11 1

j1

1

60

3.5.4 Algorithms for arbitrary values of N

• If N is not a power of 2 but a composite number, that is

N = N1N2…Nl = N1 N2l

then we can initially divide an N-point DFT into N1 DFTs with length N2l.

• We can continue this decomposition, until the lengths of all DFTs are Nl.

1

0

1

01

1

0

1 2

2)()()(

N

r

N

m

mkN

rkN

N

n

nkN

l

lWrmNxWWnxkX

61

3.6 Other discrete transforms (skipped)

62

3.7 Signal representations

• Laplace transform– Time domain: nonperiodic function of a continuous and real ti

me variable.

– Frequency domain: nonperiodic function of a continuous and complex frequency variable.

• z transform– Time domain: nonperiodic function of a discrete and integer ti

me variable.

– Frequency domain: nonperiodic function of a continuous and complex frequency variable.

63

3.7 Signal representations

• Fourier transform of continuous signals– Time domain: nonperiodic function of a continuous and real ti

me variable.

– Frequency domain: nonperiodic function of a continuous and imaginary frequency variable.

• Fourier transform of discrete signals– Time domain: nonperiodic function of a discrete and integer ti

me variable.

– Frequency domain: periodic function of a continuous and imaginary frequency variable.

64

3.7 Signal representations

• Fourier series of periodic continuous signals– Time domain: periodic function of a continuous and real time

variable.

– Frequency domain: nonperiodic function of a discrete and integer frequency variable.

• Fourier series of periodic discrete signals (DFS)– Time domain: periodic function of a discrete and integer time

variable.

– Frequency domain: periodic function of a discrete and integer frequency variable.

65

3.7 Signal representations

• Discrete Fourier transform (DFT)– Time domain: finite-length function of a discrete and integer

time variable.

– Frequency domain: finite-length function of a discrete and integer frequency variable.

• Fast Fourier transform (FFT)– FFT is no transform

– FFT is a kind of fast algorithm of DFT

66

Exercises

• 3.3 (d)• 3.7• 3.8 (b)(c)• 3.17

Recommended