3 Matched Filter

You might also like

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 34

Correlated and Uncorrelated Signals

Problem: we have two signals x[n] and y[n] . How “close” are they to each other?

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


1

0.8

0.6

Transmit
0.4

0.2

-0.2

-0.4

-0.6

-0.8

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

1.5

0.5

Receive 0

-0.5

-1

-1.5

-2
0 20 40 60 80 100 120 140 160 180
Example: Radar Return

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

1
1
0.8
0.8
0.6
0.6
0.4
0.4
0.2
0.2
0
0
-0.2
-0.2
-0.4
-0.4
-0.6
-0.6
-0.8
-0.8
-1
0 2 4 6 8 10 12 14 16 18 20
-1
0 2 4 6 8 10 12 14 16 18 20

1.5

0.5

Receive -0.5

-1

-1.5

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

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 x[n] and y[n] . How “close” are they to each other?

Define: Inner Product between two signals of the same length

N 1
rxy   x[n] y *[n]
n 0

Properties:
N 1 N 1
rxx   x[n]x [n]   x[n]  0
* 2

n 0 n 0
2
rxy  rxx ryy
2
rxy  rxx ryy if and only if y[n]  C x[n] for some constant C
How we measure similarity (correlation coefficient)

Assume: zero mean

Compute:
| rxy |
 xy 
rxx ryy

Check the value:

0   xy  1
 xy  0  xy  1

x,y uncorrelated x,y strongly correlated


Back to the Example: with no return

x[n] y[n] x[n] y[n]


2
3 3

1.5
2 2
1
1
1
0.5

0 0
0

-0.5 -1
-1

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

rxy  2.27
rxx  500
ryy  982
 xy  0.003 NO Correlation!
Back to the Example: with return

x[n] y[n] x[n] y[n]


2.5
2 3

1.5
2 2
1

0.5 1 1.5

0
0 1
-0.5
-1
-1 0.5

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

rxy  494
rxx  500
ryy  754
  0.8 Good Correlation!
Inner Product in Matlab

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

x   x(1) x( 2)  x( N ) Row vector

y   y (1) y (2)  y ( N ) Row vector

Define: Inner Product between two vectors


 y * (1) 
 * 
N
y ( 2) 
rxy   x(n) y (n)   x(1) x(2)  x( N ) 
* 
n 1
  
x  * 
 y ( N )

rxy  x * y ' y'


conjugate,
transpose
Example

Take two signals:


2.5
y 3

x 2

1.5
2

1
1
0.5

0 0

-0.5

-1 -1

-1.5
-2
-2

-2.5
0 50 100 150 200 250 300 -3
0 50 100 150 200 250 300

Then:
Compute these:
19.7
rxy  x * y '  19.7  xy   0.0856  0
218.8  241.9
rxx  x * x'  218.8
x,y are not correlated
ryy  y * y '  241.9
Example

Take two signals:


3 Compute these:
x
rxy  x * y '  230.9
2

0
rxx  x * x'  229.6
-1

-2 ryy  y * y '  234.3


-3
0 50 100 150 200 250 300

Then:
y
3

2
230.9
 xy   0.9955  1
229.6  234.3
1

-1

-2 x,y are strongly correlated


-3
0 50 100 150 200 250 300
Example

Take two signals:


3
y 3

x 2
2

1
1

0
0

-1
-1

-2
-2

-3
0 50 100 150 200 250 300
-3
0 50 100 150 200 250 300

Then:
Compute these:
230.9
rxy  x * y '  230.9  xy   0.9955  1
229.6  234.3
rxx  x * x'  229.6
x,y are strongly correlated
ryy  y * y '  234.3
Typical Application: Radar

Send a Pulse…
s[n]

n
N

… and receive it back with noise, distortion …

y[n]

n
n0

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


Use Inner Product

“Slide” the pulse s[n] over the received signal and see
when the inner product is maximum:
N 1
rys [n]   y[n  ]s *[] rys [n]  0, if n  n0
 0

y[] n


n0
s[]


N
Use Inner Product

“Slide” the pulse x[n] over the received signal and see
when the inner product is maximum:
N 1
rys [n]   y[n  ]s *[]  MAX if n  n0
 0

y[]   n0

s[]


N
Matched Filter

Take the expression


N 1
rys [n]   y[n  ]s *[]
n0

 s *[ N  1] y[n  N  1]  ...  s *[1] y[n  1]  s *[0] y[n]

Compare this, with the output of the following FIR Filter

rˆ[n]  h[0] y[n]  ...  h[1] y[n  1]  h[ N  1] y[n  N  1]


Then

y[n] h[n] rˆ[n]  rys [n  N  1]

h[n]  s *[ N  1  n], n  0,..., N  1


Matched Filter

This Filter is called a Matched Filter

y[n] rˆ[n] rˆ[n]  rys [n  N  1]


h[n]

h[n]  s *[ N  1  n], n  0,..., N  1

The output is maximum when n  N  1  n0

i.e. n  n0  N  1
Example

We transmit the pulse s[n], n  0,..., N  1 shown below, with


length N  20 1

0.8

0.6

0.4

s[n] 0.2

-0.2

-0.4

-0.6

-0.8

Max at n=119
-1
0 2 4 6 8 10 12 14 16 18 20

 n0  119  20  1  100
Received signal:
12

y[n] 1.5

10

rˆ[n]
1

y[n]
8
0.5
6

h[n]
4

-0.5 2

0
-1

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

h[n]  s *[ N  1  n], n  0,..., N  1


How do we choose a “good pulse”

We transmit the pulse s[n], n  0,..., N  1 and we receive


(ignore the noise for the time being)

y[n]  As[n  n0 ] rˆ[n] rˆ[n]  rys [n  N  1]


h[n]

h[n]  s *[ N  1  n], n  0,..., N  1


N 1
where
rys [n]  A s[n  n0  ]s *[]
n 0

 A rss [n  n0 ]
N 1
The term rss [ n]   s[n  ]s []
*

 0
is called the “autocorrelation of s[n]”. This characterizes
the pulse.
Example: a square pulse

s[n] N rss [n]

0 N 1 n N N n

N 1
rss [ n]   s[n  ]s *[]  ?
 0 N 1 N 1
rss [0]   s[]s []   s[]  N
* 2

 0  0
N 2 N 2

See a few values: rss [1]   s[1  ]s []  1  N  1


*

 0  0

N 1 k N 1 k
rss [k ]   s[k  ]s []  1  N  k
 0
*

 0
N 1 k N 1
rss [k ]   s[
 0
 k  ]s *
[]  1  N  k
 k
Compute it in Matlab

s[n]
20
1 18

16

0 N 1 n 14

12

10

8
N=20; % data length 6

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

rss=xcorr(s); % autocorr 0
-20 -15 -10 -5 0 5 10 15 20

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


stem(n,rss) % plot
Example: Sinusoid

25

1
20
0.8

0.6 15
0.4

0.2 10

0
5
-0.2

-0.4
0
-0.6

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

-15

-20

s[n], n  0,...,49
-50 -40 -30 -20 -10 0 10 20 30 40 50

rss [n], n  49,...,49


Example: Chirp

30

1
25
0.8

0.6 20

0.4
15
0.2

0
10
-0.2

-0.4
5

-0.6
0
-0.8

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

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

s[n], n  0,...,49 rss [n], n  49,...,49


s=chirp(0:49,0,49,0.1)
Example: Pseudo Noise

50

2.5
40
2

1.5
30
1

0.5
20
0

-0.5
10
-1

-1.5
0
-2

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

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

s[n], n  0,...,49

rss [n], n  49,...,49


s=randn(1,50)
Compare them

cos chirp pseudonoise


1 2.5

s[n]
1
0.8 2
0.8
0.6
0.6
1.5

0.4
0.4 1
0.2
0.2 0.5
0
0
0

-0.2 -0.2
-0.5
-0.4 -0.4
-1
-0.6 -0.6
-1.5
-0.8 -0.8
-2
-1 -1
0 5 10 15 20 25 30 35 40 45 50 0 5 10 15 20 25 30 35 40 45 50
-2.5
0 5 10 15 20 25 30 35 40 45 50

30 50

rss [n]
25

25
20 40

15 20
30
10 15

5 20
10

0
5 10
-5

0 0
-10

-15 -5
-10

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

Two best!
Detection with Noise

Now see with added noise

y[n]  As[n  n0 ]  w[n] rˆ[n]  rys [n  n0  N  1]  ryw [n]


h[n]

h[n]  s *[ N  1  n], n  0,..., N  1


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:
3

w[n] 2

-1

-2

-3

-4
0 100 200 300 400 500 600 700 800 900 1000
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.

rss [n]

n
White Noise and Filters

The output of a Filter


N 1

w[n] w[n]   h[]w[n  ]


 0
h[n]

1 M 1
1 M 1  N 1 N 1 
     h[1 ]h[2 ]w[n  1 ]w[n  2 ] 
2
w[ n]   
M n 0 M n  0  1  0 2  0 
N 1 N 1
 1 M 1 
   h[1 ]h[2 ]  w[n  1 ]w[n  2 ] 
1  0 2  0  M n 0 
 N 1 2  1
M 1

   h[]  
2
w[n] 
 0  M n 0 
White Noise

The output of a Filter


N

w[n] w[n]   h[]w[n  ]


 0
h[n]

In other words the Power of the Noise at the ouput is


related to the Power of the Noise at the input as

 N 1 2
PW    h[ n]  Pw
 n 0 
Back to the Match Filter

y[n]  As[n  n0 ]  w[n] rˆ[n]  Arss [n  n0  N  1]  w[n]


h[n]

h[n]  s *[ N  1  n], n  0,..., N  1

At the peak:

rˆ[n0  N  1]  Arss [0]  w[n0  N  1]


Match Filter and SNR

At the peak:

rˆ[n0  N  1]  Arss [0]  rsw[n0  N  1]

 N 1 2 
N 1

Arss [0]    | As[n] |   | s[n] |2 
2

 n 0  n 0 
 N 1 2
PW    | s[n] |  PW
 n 0 
 N 1 2
N  PS    s[n] 
SNR peak   n 0   N  SNR
 N 1 2
  s[n]   PW
 n 0 
Example

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

2 30

1.5 25

20
1
15
0.5
10
0
5

-0.5
0

-1 -5

-1.5 -10

-15
-2 0 200 400 600 800 1000 1200
0 50 100 150 200 250 300

Transmitted Detected with


Matched Filter
Example

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

50

2
40
1.5

30
1

0.5 20

0
10
-0.5

0
-1

-1.5 -10

-2
0 50 100 150 200 250 300 -20
0 200 400 600 800 1000 1200

Transmitted Detected with


Matched Filter
Example

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

160

2 140

1.5 120

1 100

0.5 80

0 60

-0.5 40

-1 20

-1.5 0

-2
0 50 100 150 200 250 300
-20

-40
0 200 400 600 800 1000 1200 1400

Transmitted Detected with


Matched Filter

You might also like