correlated and uncorrelated signals problem: we have two signals and. how “close” are they to...

34
Correlated and Uncorrelated Signals Problem: we have two signals and . How “close” are they to each other? ] [ n x ] [ n y Example: in a radar (or sonar) we transmit a pulse and we expect a return 0 20 40 60 80 100 120 140 160 180 -2 -1.5 -1 -0.5 0 0.5 1 1.5 0 2 4 6 8 10 12 14 16 18 20 -1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1 Transmi t Receive

Upload: corey-cole

Post on 01-Jan-2016

233 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Correlated and Uncorrelated Signals Problem: we have two signals and. How “close” are they to each other? Example: in a radar (or sonar) we transmit a

Correlated and Uncorrelated Signals

Problem: we have two signals and . How “close” are they to each other?

][nx ][ny

Example: in a radar (or sonar) we transmit a pulse and we expect a return

0 20 40 60 80 100 120 140 160 180-2

-1.5

-1

-0.5

0

0.5

1

1.5

0 2 4 6 8 10 12 14 16 18 20-1

-0.8

-0.6

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

Transmit

Receive

Page 2: Correlated and Uncorrelated Signals Problem: we have two signals and. How “close” are they to each other? Example: in a radar (or sonar) we transmit a

Example: Radar Return

Since we know what we are looking for, we keep comparing what we receive with what we sent.

0 20 40 60 80 100 120 140 160 180-2

-1.5

-1

-0.5

0

0.5

1

1.5

0 2 4 6 8 10 12 14 16 18 20-1

-0.8

-0.6

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

Receive

0 2 4 6 8 10 12 14 16 18 20-1

-0.8

-0.6

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

Similar? NO! Think so!

Page 3: Correlated and Uncorrelated Signals Problem: we have two signals and. How “close” are they to each other? Example: in a radar (or sonar) we transmit a

Inner Product between two Signals

We need a “measure” of how close two signals are to each other.

This leads to the concepts of

• Inner Product

• Correlation Coefficient

Page 4: Correlated and Uncorrelated Signals Problem: we have two signals and. How “close” are they to each other? Example: in a radar (or sonar) we transmit a

Inner Product

Problem: we have two signals and . How “close” are they to each other?

][nx ][ny

Define: Inner Product between two signals of the same length

1

0

* ][][N

nxy nynxr

Properties:

0][][][1

0

21

0

*

N

n

N

nxx nxnxnxr

yyxxxy rrr 2

yyxxxy rrr 2

if and only if ][][ nxCny for some constant C

Page 5: Correlated and Uncorrelated Signals Problem: we have two signals and. How “close” are they to each other? Example: in a radar (or sonar) we transmit a

How we measure similarity (correlation coefficient)

yyxx

xyxy

rr

r ||

Compute:

Check the value:

10 xy1xy

x,y strongly correlatedx,y uncorrelated

0xy

Assume: zero mean

Page 6: Correlated and Uncorrelated Signals Problem: we have two signals and. How “close” are they to each other? Example: in a radar (or sonar) we transmit a

003.0

982

500

27.2

xy

yy

xx

xy

r

r

r

Back to the Example: with no return

0 100 200 300 400 500 600 700 800 900-2

-1.5

-1

-0.5

0

0.5

1

1.5

2

0 100 200 300 400 500 600 700 800 900-3

-2

-1

0

1

2

3

0 100 200 300 400 500 600 700 800 900 1000-3

-2

-1

0

1

2

3

][nx ][ny ][][ nynx

NO Correlation!

Page 7: Correlated and Uncorrelated Signals Problem: we have two signals and. How “close” are they to each other? Example: in a radar (or sonar) we transmit a

Back to the Example: with return

8.0

754

500

494

yy

xx

xy

r

r

r

0 100 200 300 400 500 600 700 800 900-2

-1.5

-1

-0.5

0

0.5

1

1.5

2

0 100 200 300 400 500 600 700 800 900-3

-2

-1

0

1

2

3

0 100 200 300 400 500 600 700 800 900 1000-0.5

0

0.5

1

1.5

2

2.5][nx ][ny ][][ nynx

Good Correlation!

Page 8: Correlated and Uncorrelated Signals Problem: we have two signals and. How “close” are they to each other? Example: in a radar (or sonar) we transmit a

Inner Product in Matlab

)()2()1( Nxxxx

)()2()1( Nyyyy

Row vector

Row vector

)(

)2(

)1(

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

*

*

*

1

*

Ny

y

y

NxxxnynxrN

nxy

'* yxrxy

x

'yconjugate, transpose

Take two signals of the same length. Each one is a vector:

Define: Inner Product between two vectors

Page 9: Correlated and Uncorrelated Signals Problem: we have two signals and. How “close” are they to each other? Example: in a radar (or sonar) we transmit a

Example

Take two signals:

0 50 100 150 200 250 300-2.5

-2

-1.5

-1

-0.5

0

0.5

1

1.5

2

2.5

xy

0 50 100 150 200 250 300-3

-2

-1

0

1

2

3

Compute these:Then:

00856.09.2418.218

7.19

xy

x,y are not correlated

7.19'* yxrxy

8.218'* xxrxx

9.241'* yyryy

Page 10: Correlated and Uncorrelated Signals Problem: we have two signals and. How “close” are they to each other? Example: in a radar (or sonar) we transmit a

Example

Take two signals:

x

y

9.230'* yxrxy

6.229'* xxrxx

3.234'* yyryy

Compute these:

Then:

19955.03.2346.229

9.230

xy

x,y are strongly correlated

0 50 100 150 200 250 300-3

-2

-1

0

1

2

3

0 50 100 150 200 250 300-3

-2

-1

0

1

2

3

Page 11: Correlated and Uncorrelated Signals Problem: we have two signals and. How “close” are they to each other? Example: in a radar (or sonar) we transmit a

Example

Take two signals:

Compute these:Then:

19955.03.2346.229

9.230

xy

x,y are strongly correlated

xy

0 50 100 150 200 250 300-3

-2

-1

0

1

2

3

0 50 100 150 200 250 300-3

-2

-1

0

1

2

3

9.230'* yxrxy

6.229'* xxrxx

3.234'* yyryy

Page 12: Correlated and Uncorrelated Signals Problem: we have two signals and. How “close” are they to each other? Example: in a radar (or sonar) we transmit a

Typical Application: Radar

][ns

n

Send a Pulse…

][ny

n

0n

… and receive it back with noise, distortion …N

Problem: estimate the time delay , ie detect when we receive it.0n

Page 13: Correlated and Uncorrelated Signals Problem: we have two signals and. How “close” are they to each other? Example: in a radar (or sonar) we transmit a

Use Inner Product

“Slide” the pulse s[n] over the received signal and see when the inner product is maximum:

][s

][y

0n

N

n

1

0

* ][][][N

ys snynr

0 if ,0][ nnnrys

Page 14: Correlated and Uncorrelated Signals Problem: we have two signals and. How “close” are they to each other? Example: in a radar (or sonar) we transmit a

Use Inner Product

][s

“Slide” the pulse x[n] over the received signal and see when the inner product is maximum:

][y

N

0n

if 0nnMAXsnynrN

ys

1

0

* ][][][

Page 15: Correlated and Uncorrelated Signals Problem: we have two signals and. How “close” are they to each other? Example: in a radar (or sonar) we transmit a

Matched Filter

Take the expression

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

][][][

***

1

0

*

nysnysNnyNs

snynrN

nys

Then

]1[]1[]1[]1[...][]0[][ˆ NnyNhnyhnyhnr

][ny ][nh

1,...,0 ],1[][ * NnnNsnh

]1[][ˆ Nnrnr ys

Compare this, with the output of the following FIR Filter

Page 16: Correlated and Uncorrelated Signals Problem: we have two signals and. How “close” are they to each other? Example: in a radar (or sonar) we transmit a

Matched Filter

This Filter is called a Matched Filter

The output is maximum when

][ny ][ˆ nr][nh

1,...,0 ],1[][ * NnnNsnh

]1[][ˆ Nnrnr ys

01 nNn

10 Nnni.e.

Page 17: Correlated and Uncorrelated Signals Problem: we have two signals and. How “close” are they to each other? Example: in a radar (or sonar) we transmit a

Example

0 2 4 6 8 10 12 14 16 18 20-1

-0.8

-0.6

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

][ns

0 20 40 60 80 100 120 140 160 180 200-6

-4

-2

0

2

4

6

8

10

12

0 20 40 60 80 100 120 140 160 180-2

-1.5

-1

-0.5

0

0.5

1

1.5][ny

][ny ][ˆ nr

][nh

1,...,0 ],1[][ * NnnNsnh

1,...,0],[ NnnsWe transmit the pulse shown below, with length 20N

Received signal:

Max at n=1191001201190 n

Page 18: Correlated and Uncorrelated Signals Problem: we have two signals and. How “close” are they to each other? Example: in a radar (or sonar) we transmit a

How do we choose a “good pulse”

1,...,0],[ NnnsWe transmit the pulse and we receive (ignore the noise for the time being)

][

][][][

0

1

0

*0

nnrA

snnsAnr

ss

N

nys

][][ 0nnAsny ][ˆ nr][nh

1,...,0 ],1[][ * NnnNsnh

]1[][ˆ Nnrnr ys

where

The term

is called the “autocorrelation of s[n]”. This characterizes the pulse.

1

0

* ][][][N

ss snsnr

Page 19: Correlated and Uncorrelated Signals Problem: we have two signals and. How “close” are they to each other? Example: in a radar (or sonar) we transmit a

Example: a square pulse

?][][][1

0

*

N

ss snsnr

NsssrNN

ss

1

0

21

0

* ][][][]0[

11][]1[]1[2

0

2

0

*

NssrNN

ss

kNskskrkNkN

ss

1

0

1

0

* 1][][][

][nrss][ns

n1N

1

0

N

N N n

See a few values:

kNskskrN

k

kN

ss

11

0

* 1][][][

Page 20: Correlated and Uncorrelated Signals Problem: we have two signals and. How “close” are they to each other? Example: in a radar (or sonar) we transmit a

Compute it in Matlab

][ns

n1N

1

0

N=20; % data length

s=ones(1,N); % square pulse

rss=xcorr(s); % autocorr

n=-N+1:N-1; % indices for plot

stem(n,rss) % plot

-20 -15 -10 -5 0 5 10 15 200

2

4

6

8

10

12

14

16

18

20

Page 21: Correlated and Uncorrelated Signals Problem: we have two signals and. How “close” are they to each other? Example: in a radar (or sonar) we transmit a

Example: Sinusoid

49,...,0],[ nns-50 -40 -30 -20 -10 0 10 20 30 40 50

-20

-15

-10

-5

0

5

10

15

20

25

0 5 10 15 20 25 30 35 40 45 50-1

-0.8

-0.6

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

49,...,49],[ nnrss

Page 22: Correlated and Uncorrelated Signals Problem: we have two signals and. How “close” are they to each other? Example: in a radar (or sonar) we transmit a

Example: Chirp

49,...,49],[ nnrss49,...,0],[ nns

0 5 10 15 20 25 30 35 40 45 50-1

-0.8

-0.6

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

-50 -40 -30 -20 -10 0 10 20 30 40 50-10

-5

0

5

10

15

20

25

30

s=chirp(0:49,0,49,0.1)

Page 23: Correlated and Uncorrelated Signals Problem: we have two signals and. How “close” are they to each other? Example: in a radar (or sonar) we transmit a

Example: Pseudo Noise

49,...,49],[ nnrsss=randn(1,50)

49,...,0],[ nns

0 5 10 15 20 25 30 35 40 45 50-2.5

-2

-1.5

-1

-0.5

0

0.5

1

1.5

2

2.5

-50 -40 -30 -20 -10 0 10 20 30 40 50-20

-10

0

10

20

30

40

50

Page 24: Correlated and Uncorrelated Signals Problem: we have two signals and. How “close” are they to each other? Example: in a radar (or sonar) we transmit a

Compare them

-50 -40 -30 -20 -10 0 10 20 30 40 50-20

-10

0

10

20

30

40

50

-50 -40 -30 -20 -10 0 10 20 30 40 50-10

-5

0

5

10

15

20

25

30

0 5 10 15 20 25 30 35 40 45 50-2.5

-2

-1.5

-1

-0.5

0

0.5

1

1.5

2

2.5

0 5 10 15 20 25 30 35 40 45 50-1

-0.8

-0.6

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

0 5 10 15 20 25 30 35 40 45 50-1

-0.8

-0.6

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

-50 -40 -30 -20 -10 0 10 20 30 40 50-20

-15

-10

-5

0

5

10

15

20

25

][ns

][nrss

cos chirp pseudonoise

Two best!

Page 25: Correlated and Uncorrelated Signals Problem: we have two signals and. How “close” are they to each other? Example: in a radar (or sonar) we transmit a

Detection with Noise

Now see with added noise

][][][ 0 nwnnAsny ][nh

1,...,0 ],1[][ * NnnNsnh

][]1[][ˆ 0 nrNnnrnr ywys

Page 26: Correlated and Uncorrelated Signals Problem: we have two signals and. How “close” are they to each other? Example: in a radar (or sonar) we transmit a

White Noise

A first approximation of a disturbance is by “White Noise”.

White noise is such that any two different samples are uncorrelated with each other:

0 100 200 300 400 500 600 700 800 900 1000-4

-3

-2

-1

0

1

2

3

][nw

Page 27: Correlated and Uncorrelated Signals Problem: we have two signals and. How “close” are they to each other? Example: in a radar (or sonar) we transmit a

White Noise

The autocorrelation of a white noise signal tends to be a “delta” function, ie it is always zero, apart from when n=0.

][nrss

n

Page 28: Correlated and Uncorrelated Signals Problem: we have two signals and. How “close” are they to each other? Example: in a radar (or sonar) we transmit a

White Noise and Filters

The output of a Filter

][nw][nh

1

0

][][][N

nwhnw

1

0

21

0

2

1

0

1

0

1

02121

1

0

1

0

1

02121

1

0

2

][1

][

][][1

][][

][][][][1

][1

1 2

1 2

M

n

N

N N M

n

M

n

N NM

n

nwM

h

nwnwM

hh

nwnwhhM

nwM

Page 29: Correlated and Uncorrelated Signals Problem: we have two signals and. How “close” are they to each other? Example: in a radar (or sonar) we transmit a

White Noise

The output of a Filter

][nw][nh

N

nwhnw0

][][][

In other words the Power of the Noise at the ouput is related to the Power of the Noise at the input as

w

N

nW PnhP

1

0

2][

Page 30: Correlated and Uncorrelated Signals Problem: we have two signals and. How “close” are they to each other? Example: in a radar (or sonar) we transmit a

Back to the Match Filter

At the peak:

][][][ 0 nwnnAsny ][nh

1,...,0 ],1[][ * NnnNsnh

][]1[][ˆ 0 nwNnnArnr ss

]1[]0[]1[ˆ 00 NnwArNnr ss

Page 31: Correlated and Uncorrelated Signals Problem: we have two signals and. How “close” are they to each other? Example: in a radar (or sonar) we transmit a

Match Filter and SNR

At the peak:

]1[]0[]1[ˆ 00 NnrArNnr swss

1

0

21

0

22|][||][|]0[

N

n

N

nss nsnAsAr

W

N

nW PnsP

1

0

2|][|

SNRN

Pns

nsPN

SNR

W

N

n

N

nS

peak

1

0

2

1

0

2

][

][

Page 32: Correlated and Uncorrelated Signals Problem: we have two signals and. How “close” are they to each other? Example: in a radar (or sonar) we transmit a

Example

Transmit a Chirp of length N=50 samples, with SNR=0dB

0 50 100 150 200 250 300-2

-1.5

-1

-0.5

0

0.5

1

1.5

2

0 200 400 600 800 1000 1200-15

-10

-5

0

5

10

15

20

25

30

Transmitted Detected with Matched Filter

Page 33: Correlated and Uncorrelated Signals Problem: we have two signals and. How “close” are they to each other? Example: in a radar (or sonar) we transmit a

Example

Transmit a Chirp of length N=100 samples, with SNR=0dB

0 50 100 150 200 250 300-2

-1.5

-1

-0.5

0

0.5

1

1.5

2

0 200 400 600 800 1000 1200-20

-10

0

10

20

30

40

50

Transmitted Detected with Matched Filter

Page 34: Correlated and Uncorrelated Signals Problem: we have two signals and. How “close” are they to each other? Example: in a radar (or sonar) we transmit a

Example

Transmit a Chirp of length N=300 samples, with SNR=0dB

0 50 100 150 200 250 300-2

-1.5

-1

-0.5

0

0.5

1

1.5

2

0 200 400 600 800 1000 1200 1400-40

-20

0

20

40

60

80

100

120

140

160

Transmitted Detected with Matched Filter