3 matched filter

Upload: phan-giang-chau

Post on 05-Apr-2018

256 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/31/2019 3 Matched Filter

    1/34

    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.4

    0.6

    0.8

    1

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

    -0.8

    -0.6

    -0.4

    -0.2

    0

    0.2

    0

    0 . 5

    1

    1 . 5

    Receive

    0 2 0 4 0 6 0 8 0 1 0 0 1 2 0 1 4 0 1 6 0 1 8 0- 2

    - 1 . 5

    - 1

    - .

  • 7/31/2019 3 Matched Filter

    2/34

    Example: Radar Return

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

    -0.6

    -0.4

    -0.2

    0

    0.2

    0.4

    0.6

    0.8

    1

    -0.6

    -0.4

    -0.2

    0

    0.2

    0.4

    0.6

    0.8

    1

    0 . 5

    1

    1 . 5

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

    -0.8

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

    -0.8

    - 1 . 5

    - 1

    - 0 . 5

    0

    Receive

    0 2 0 4 0 6 0 8 0 1 0 0 1 2 0 1 4 0 1 6 0 1 8 0

    - 2

    Similar? NO! Think so!

  • 7/31/2019 3 Matched Filter

    3/34

    Inner Product between two Signals

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

    Inner Product

    Correlation Coefficient

  • 7/31/2019 3 Matched Filter

    4/34

    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

    1N

    =

    =

    0

    * ][][n

    xy nynxr

    0][][][1

    0

    21

    0

    *==

    =

    =

    N

    n

    N

    n

    xx nxnxnxr

    yyxxxy rrr 2

    2

    yyxxxy = an on y

  • 7/31/2019 3 Matched Filter

    5/34

    How we measure similarity (correlation coefficient)

    Assume: zero mean

    xyr ||Compute:

    yyxx

    xyrr

    Check the value:

    10 xy

    1xy

    x,ystrongly correlatedx,yuncorrelated

    0xy

  • 7/31/2019 3 Matched Filter

    6/34

    Back to the Example: with no return

    1.5

    2

    2

    3

    2

    3

    ][nx ][ny ][][ nynx

    -

    -0.5

    0

    0.5

    -1

    0

    1

    -1

    0

    1

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

    -1.5

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

    -2

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

    -2

    27.2=xyr

    003.0

    982

    =

    =yy

    xx

    r

  • 7/31/2019 3 Matched Filter

    7/34

    Back to the Example: with return

    1

    1.5

    2

    2

    3

    2

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

    -1

    -0.5

    0

    0.5

    -1

    0

    1

    0.5

    1

    1.5

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

    -1.5

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

    -2

    0 100 200 300 400 500 600 700 800 900 1000

    -0.5

    0

    494=r

    754

    500

    =

    =

    yy

    xx

    r

    r

    8.0= Good Correlation!

  • 7/31/2019 3 Matched Filter

    8/34

    Inner Product in Matlab

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

    [ ])()2()1( Nyyyy =

    Row vector

    )2(

    )1(

    *

    *

    * y

    y

    N

    Define: Inner Product between two vectors

    ==

    =

    )(*1

    Ny

    n

    xy

    x

    '*yxrxy = 'y

    conjugate,transpose

  • 7/31/2019 3 Matched Filter

    9/34

    Example

    Take two signals:

    2.5 3

    0

    0.5

    1

    1.5

    2x

    0

    1

    2

    0 50 100 150 200 250 300-2.5

    -2

    -1.5

    -1

    -0.5

    0 50 100 150 200 250 300-3

    -2

    -1

    Compute these:Then:

    00856.07.19

    ==7.19'* == yxr

    9.2418.218

    x,y are not correlated

    8.218'* == xxrxx

    '* == .yy

  • 7/31/2019 3 Matched Filter

    10/34

    Example

    Take two signals:

    Compute these:3

    x9.230'* == yxrxy

    '* ==01

    2

    xx

    3.234'* == yyryy0 50 100 150 200 250 300

    -3

    -2

    -1

    yThen:

    19955.09.230

    ==xy1

    2

    3

    ..

    x,y are strongly correlated-2

    -1

    0

    0 50 100 150 200 250 300-3

  • 7/31/2019 3 Matched Filter

    11/34

    Example

    Take two signals:

    33

    x

    0

    1

    2

    0

    1

    2

    0 50 100 150 200 250 300-3

    -2

    -1

    -3

    -2

    -1

    Compute these:Then:

    19955.09.230

    ==xy

    0 50 100 150 200 250 300

    '* ==..

    x,y are strongly correlated

    .xy

    6.229'* == xxrxx

    ' .== yyryy

  • 7/31/2019 3 Matched Filter

    12/34

    Typical Application: Radar

    ][ns

    Send a Pulse

    n

    N

    ][ny

    and receive it back with noise, distortion

    n

    0n

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

  • 7/31/2019 3 Matched Filter

    13/34

    Use Inner Product

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

    =

    +=1

    0

    * ][][][N

    ys snynr

    0if,0][ nnnrys

    ][y

    n

    ][s0n

    N

  • 7/31/2019 3 Matched Filter

    14/34

    Use Inner Product

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

    if 0nn =MAXsnynrN

    ys =+=

    =

    1

    0

    * ][][][

    ][y

    0n=

    ][s

    N

  • 7/31/2019 3 Matched Filter

    15/34

    Matched Filter

    Take the expression

    011...11

    ][][][***

    0

    *

    nsnsNnNs

    snynr nys

    +++++=

    +=

    =

    Compare this, with the output of the following FIR Filter

    Then

    ]1[]1[]1[]1[...][]0[][ ++++= NnyNhnyhnyhnr

    ][ny ][nh ]1[][ += Nnrnr ys

    1,...,0],1[][ == NnnNsnh

  • 7/31/2019 3 Matched Filter

    16/34

    Matched Filter

    This Filter is called a Matched Filter

    ][ny ][ nr][nh

    ]1[][ += Nnrnr ys

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

    0

    10 += Nnni.e.

  • 7/31/2019 3 Matched Filter

    17/34

    Example

    0.4

    0.6

    0.8

    1

    1,...,0],[ = NnnsWe transmit the pulse shown below, withlength 20=N

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

    -0.8

    -0.6

    -0.4

    -0.2

    0

    0.2ns

    Max at n=119

    10

    121.5

    ][ny

    Received signal:1001201190 =+= n

    0

    2

    4

    6

    8

    -1

    -0.5

    0

    0.5

    1

    ][ny ][ nr

    ][nh

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

    -4

    -2

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

    -1.5

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

  • 7/31/2019 3 Matched Filter

    18/34

    How do we choose a good pulse

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

    ][][ 0nnAsny=

    ][nr][nh

    ]1[][ += Nnrnr ys

    1N

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

    ][

    ][][][

    0

    0

    0

    nnrA

    snnsnr

    ss

    n

    ys

    =

    +=

    =

    The term

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

    =

    +=1

    0

    * ][][][N

    ss snsnr

    the pulse.

  • 7/31/2019 3 Matched Filter

    19/34

    Example: a square pulse

    ][nrss][ns

    1

    N

    n1N0 N N n

    ?][][][1

    0

    *=+=

    =

    N

    ss snsnr

    NsssrNN

    ===

    1

    2

    1

    * ][][][]0[ == 00

    11][]1[]1[2

    0

    2

    0

    *==+=

    =

    =

    NssrNN

    ss

    See a few values:

    kNskskrkNkN

    ss ==+=

    =

    =

    1

    0

    1

    0

    * 1][][][

    NkN 11*

    ssrk

    ss ===

    ==0

  • 7/31/2019 3 Matched Filter

    20/34

    Compute it in Matlab

    ][ns

    118

    20

    n1N012

    14

    16

    N=20; % data length

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

    8

    rss=xcorr(s); % autocorr

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

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

    2

    stem(n,rss) % plot

  • 7/31/2019 3 Matched Filter

    21/34

    Example: Sinusoid

    15

    20

    25

    0.6

    0.8

    1

    0

    5

    10

    -0.6

    -0.4

    -0.2

    0

    0.2

    0.4

    -20

    -15

    -10

    -5

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

    -0.8

    49,...,0],[ =nns- - - - -

    49,...,49],[ =nnrss

  • 7/31/2019 3 Matched Filter

    22/34

    Example: Chirp

    0.4

    0.6

    0.8

    1

    20

    25

    30

    -0.6

    -0.4

    -0.2

    0

    0.2

    0

    5

    10

    15

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

    -0.8

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

    -5

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

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

  • 7/31/2019 3 Matched Filter

    23/34

    Example: Pseudo Noise

    1.5

    2

    2.5

    40

    50

    -2

    -1.5

    -1

    -0.5

    0

    0.5

    1

    0

    10

    20

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

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

    -10

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

    ,...,, =nns

  • 7/31/2019 3 Matched Filter

    24/34

    Compare them

    2

    2.5

    0.6

    0.8

    1

    0.8

    1

    ns

    cos chirp pseudonoise

    -1.5

    -1

    -0.5

    0

    0.5

    1

    .

    -0.8

    -0.6

    -0.4

    -0.2

    0

    0.2

    0.4

    -0.8

    -0.6

    -0.4

    -0.2

    0

    0.2

    0.4

    0.6

    50

    25

    30

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

    -2

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

    .

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

    25

    0

    10

    20

    30

    40

    0

    5

    10

    15

    20

    -10

    -5

    0

    5

    10

    15

    20

    ss

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

    -10

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

    -5

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

    -15

    Two best!

  • 7/31/2019 3 Matched Filter

    25/34

    Detection with Noise

    Now see with added noise

    ][][][ 0 nwnnAsny += ][]1[][ 0 nrNnnrnr ywys ++=

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

  • 7/31/2019 3 Matched Filter

    26/34

    White Noise

    A first approximation of a disturbance is by White Noise.

    White noise is such that any two different samples areuncorre a e w eac o er:

    2

    3

    nw

    0

    1

    -3

    -2

    -

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

  • 7/31/2019 3 Matched Filter

    27/34

    White Noise

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

    ][nrss

    n

  • 7/31/2019 3 Matched Filter

    28/34

    White Noise and Filters

    The output of a Filter

    =

    1N

    nw

    ][nh=0

    =

    1 1 1

    2121

    12

    ][][][][

    1

    ][

    1 M N NM

    nwnwhhnw

    =

    = = ==

    1 1 1

    2121

    0 0 00

    ][][1

    ][][

    1 2

    N N M

    nn

    nwnwhh

    =

    = = =

    12

    12

    0 0 0

    1

    1 2

    MN

    n

    nwh

    == 00 n

  • 7/31/2019 3 Matched Filter

    29/34

    White Noise

    The output of a Filter

    =

    N

    nw

    ][nh=0

    related to the Power of the Noise at the input as

    w

    n

    W PnhP

    =

    =0

    2][

  • 7/31/2019 3 Matched Filter

    30/34

    Back to the Match Filter

    ][][][ 0 nwnnAsny +=

    ][nh

    0 nwnnrnr ss ++=

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

    ]1[]0[]1[ 00 ++=+ NnwArNnr ss

  • 7/31/2019 3 Matched Filter

    31/34

    Match Filter and SNR

    At the peak:

    ]1[]0[]1[ 00++=+

    NnrArNnr swss

    =

    =

    =

    1

    0

    21

    0

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

    n

    N

    n

    ss nsnAsAr

    W

    n

    WPnsP

    =

    =0

    2|][|

    N 1 2

    SNRN

    Pns

    ns

    SNRN

    nS

    peak =

    =

    =

    12

    0

    ][n=0

  • 7/31/2019 3 Matched Filter

    32/34

    Example

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

    2 30

    0

    0.5

    1

    1.5

    10

    15

    20

    25

    -2

    -1.5

    -1

    -0.5

    -15

    -10

    -5

    0

    0 50 100 150 200 250 300

    Transmitted Detected withMatched Filter

  • 7/31/2019 3 Matched Filter

    33/34

    Example

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

    1

    1.5

    2

    30

    40

    50

    -1

    -0.5

    0

    0.5

    0

    10

    20

    0 50 100 150 200 250 300-2

    -1.5

    0 200 400 600 800 1000 1200-20

    -10

    Transmitted Detected witha c e er

  • 7/31/2019 3 Matched Filter

    34/34

    Example

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

    2 140

    160

    0

    0.5

    1

    1.5

    60

    80

    100

    120

    0 50 100 150 200 250 300-2

    -1.5

    -1

    -0.5

    -20

    0

    20

    40

    0 200 400 600 800 1000 1200 1400

    -40

    TransmittedDetected with

    i r