correlated and uncorrelated signals problem: we have two signals and. how “close” are they to...
TRANSCRIPT
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
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!
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
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
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
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!
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!
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
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
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
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
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
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
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
* ][][][
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
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.
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
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
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][][][
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
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
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)
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
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!
Detection with Noise
Now see with added noise
][][][ 0 nwnnAsny ][nh
1,...,0 ],1[][ * NnnNsnh
][]1[][ˆ 0 nrNnnrnr ywys
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
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
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
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][
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
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
][
][
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
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
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