1 bien425 – lecture 8 by the end of the lecture, you should be able to: –compute cross-...

22
1 BIEN425 – Lecture 8 By the end of the lecture, you should be able to: Compute cross- /auto-correlation using matrix multiplication Compute cross- /auto-correlation using DFT and Matlab Relate auto-correlation of white noise with its average power Extract periodic signal from noise

Upload: hector-hopkins

Post on 01-Jan-2016

216 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 1 BIEN425 – Lecture 8 By the end of the lecture, you should be able to: –Compute cross- /auto-correlation using matrix multiplication –Compute cross- /auto-correlation

1

BIEN425 – Lecture 8

• By the end of the lecture, you should be able to:– Compute cross- /auto-correlation using matrix

multiplication– Compute cross- /auto-correlation using DFT and Matlab– Relate auto-correlation of white noise with its average

power– Extract periodic signal from noise

Page 2: 1 BIEN425 – Lecture 8 By the end of the lecture, you should be able to: –Compute cross- /auto-correlation using matrix multiplication –Compute cross- /auto-correlation

2

Recall: Convolution

• Is a filter operation that computes the zero-state output corresponding to an input x(k)

• Matlab code: conv.m

• As denoted by *• If h(i) is a L-point signal, and x(k) is a M-point

signal then the convolution has length L+M-1

k

i

ikxihkxkhky0

)()()(*)()(

Page 3: 1 BIEN425 – Lecture 8 By the end of the lecture, you should be able to: –Compute cross- /auto-correlation using matrix multiplication –Compute cross- /auto-correlation

3

Circular convolution

• Let h(k) and x(k) be N-point signals and xp(k) be the periodic extension of x(k). Circular convolution is defined as

• Very simply yc(k) = C(x)h, where C(x) is defined as:

1

0

)()()()(N

ip ikxihkxkh

)0()1()2(

)1()0()1(

)2()1()0(

)(xxx

Nxxx

NxNxx

xC

Page 4: 1 BIEN425 – Lecture 8 By the end of the lecture, you should be able to: –Compute cross- /auto-correlation using matrix multiplication –Compute cross- /auto-correlation

4

• Note that circular convolution is more efficient (faster)

• However, it cannot be used directly to compute zero-state response

• Also needs to assume h(k) and x(k) have the same length.

• Another problem is with periodicity

• We can solve this using zero-padding.

)()( kyNky cc

But the zero-state response is not periodic

Page 5: 1 BIEN425 – Lecture 8 By the end of the lecture, you should be able to: –Compute cross- /auto-correlation using matrix multiplication –Compute cross- /auto-correlation

5

Zero padding

• Pad both h(k) and x(k) to be length N = L+M-1, now denoted as hz(k) and xz(k)

• Now, y = C(xz)hz

Tz

Tz

Mxxkx

Lhhkh

],0,0),1()0([)(

],0,0),1()0([)(

y is now M+L-1 in length

Page 6: 1 BIEN425 – Lecture 8 By the end of the lecture, you should be able to: –Compute cross- /auto-correlation using matrix multiplication –Compute cross- /auto-correlation

6

Example

• Matlab example

Page 7: 1 BIEN425 – Lecture 8 By the end of the lecture, you should be able to: –Compute cross- /auto-correlation using matrix multiplication –Compute cross- /auto-correlation

7

Fast convolution

• Convolution in the time domain maps into multiplication in the frequency domain using Z-transform.

• We may substitute circular for linear convolution; DFT for Z-transform

)()()}({ zXzHkyZ

)()()}()({ iXiHkxkhDFT

Page 8: 1 BIEN425 – Lecture 8 By the end of the lecture, you should be able to: –Compute cross- /auto-correlation using matrix multiplication –Compute cross- /auto-correlation

8

• Now if enough zeros are padded to h(k) and x(k) so that they both have length N≥L+M-1 where N = 2r

• This is called fast linear convolution

We get Hz(i) and Xz(i)

Zero pad

Zero pad

FFT

FFT

IFFT

h(k)

x(k)

y(k)

xz(k)

hz(k)

)}()({)( iXiHIFFTky zz

Page 9: 1 BIEN425 – Lecture 8 By the end of the lecture, you should be able to: –Compute cross- /auto-correlation using matrix multiplication –Compute cross- /auto-correlation

9

Cross-correlation

• Measures the degree to which a pattern of L-point signal y(k) is similar to the pattern of an M-point signal x(k)

• This definition works fine for deterministic signals.

• To generalize it to include stochastic signals:

For example: on next slide

1

0

)()(1

)(L

ixy kiyix

Lkr

)]()([)( kiyixkrxy

Page 10: 1 BIEN425 – Lecture 8 By the end of the lecture, you should be able to: –Compute cross- /auto-correlation using matrix multiplication –Compute cross- /auto-correlation

10

Page 11: 1 BIEN425 – Lecture 8 By the end of the lecture, you should be able to: –Compute cross- /auto-correlation using matrix multiplication –Compute cross- /auto-correlation

11

• Again, it can be computed using matrix formulation:

• Example 4.8, the index corresponding to the largest rxy(k) represents the optimal delay.

)0(00

00)1()2()1()0(0

00)1()1()0(

1)(

)(

y

MyMyyy

Myyy

LyC

xyDrxy

Page 12: 1 BIEN425 – Lecture 8 By the end of the lecture, you should be able to: –Compute cross- /auto-correlation using matrix multiplication –Compute cross- /auto-correlation

12This shows optimal delay for y is 3 samples

Page 13: 1 BIEN425 – Lecture 8 By the end of the lecture, you should be able to: –Compute cross- /auto-correlation using matrix multiplication –Compute cross- /auto-correlation

13

Normalized linear cross-correlation

• So that it takes on values [-1, 1]

)0()0(

)()(

yyxxLM

xyxy rr

krkP

This allows us to measure the amount of “significance” that is independent on the scaling or amplitude of the signal

Page 14: 1 BIEN425 – Lecture 8 By the end of the lecture, you should be able to: –Compute cross- /auto-correlation using matrix multiplication –Compute cross- /auto-correlation

14We can have a fixed threshold to determine if two signalsare significantly similar.

Page 15: 1 BIEN425 – Lecture 8 By the end of the lecture, you should be able to: –Compute cross- /auto-correlation using matrix multiplication –Compute cross- /auto-correlation

15

Fast correlation

• Again, similar to fast convolution, we could utilize properties of FFT to achieve a fast version of correlation

• Block diagram:

Zero pad

Zero pad

FFT

FFT *

IFFT /L

x(k)

y(k)

rxy(k)

yz(k)

xz(k)

LiYiXIFFT

kr zzxy

)}()({)(

*

Page 16: 1 BIEN425 – Lecture 8 By the end of the lecture, you should be able to: –Compute cross- /auto-correlation using matrix multiplication –Compute cross- /auto-correlation

16

Auto-correlation

• For special case where y(k) = x(k)

• It can be expressed in terms of expected values

• For the special case of white noise v(k),

1

0

)()(1

)(N

ixx kixix

Nkr

xxx

xx

Pr

kixixkr

)0(

)]()([)(

0,

0,0)(

kP

kkr

vvv

Page 17: 1 BIEN425 – Lecture 8 By the end of the lecture, you should be able to: –Compute cross- /auto-correlation using matrix multiplication –Compute cross- /auto-correlation

17

Relating auto-correlation and PSD

)()()(1

)}({

)}()({)}({

*

1

iSiXiXN

kcDFT

kxkxDFTkcDFT

Nxx

Nxx

If we apply the same principle of circular convolution to correlation, circular-correlation cxy(k) can be obtained

Notice here (–k)

Page 18: 1 BIEN425 – Lecture 8 By the end of the lecture, you should be able to: –Compute cross- /auto-correlation using matrix multiplication –Compute cross- /auto-correlation

18

Extracting periodic signals from noise

• Let’s say y(k) = x(k) + v(k), 0≤ k <N and the period M<N.

• Therefore, for k≠0, cyy(k) = cxx(k)

Motivation?

x(k) is periodic M (but we didn’t know that from the beginning

)()()(

)}()({)(

kPkckc

kiyiykc

vxxyy

pyy

Because correlation of noise with any other signal is 0!

Page 19: 1 BIEN425 – Lecture 8 By the end of the lecture, you should be able to: –Compute cross- /auto-correlation using matrix multiplication –Compute cross- /auto-correlation

19

• Auto-correlation averages the noise out!

• Also note that cxx(k) is periodic

• Therefore, the period of x(k) can be estimated by examining the peaks and valleys in cyy(k)

)()( kcMkc xxxx

Page 20: 1 BIEN425 – Lecture 8 By the end of the lecture, you should be able to: –Compute cross- /auto-correlation using matrix multiplication –Compute cross- /auto-correlation

20

• Once the period of a noise-corrupted signal is determined, we can estimate the original periodic signal

• Let L = floor (N/M)• We define delta function of period M

1

0

)()(L

iM iMkk 0 ≤ k < M

1

0

1

0

)(1

)(

)()(1

)(

)()(

L

qpy

N

ipMy

yy

kqMyN

kc

kiyiN

kc

kckc

M

M

MM

By definition

Because L = floor of (N/M)

Page 21: 1 BIEN425 – Lecture 8 By the end of the lecture, you should be able to: –Compute cross- /auto-correlation using matrix multiplication –Compute cross- /auto-correlation

21

• Now the second term approaches 0 for large L• Therefore

1

0

1

0

1

0

1

0

1

0

)(1

)()(

)(1

)(1

)(

)(1

)(1

)(

L

qpy

L

qp

L

qy

L

qp

L

qpy

kqMvN

kxNL

kc

kqMvN

kxN

kc

kqMvN

kqMxN

kc

M

M

M

Because x is period M

)()(ˆ kcLN

kxMy

Page 22: 1 BIEN425 – Lecture 8 By the end of the lecture, you should be able to: –Compute cross- /auto-correlation using matrix multiplication –Compute cross- /auto-correlation

22

Block diagram

Circularcross

correlation

y(k)x(k)

v(k)

(k)

)(kcMy )(ˆ kxN/L