Forums

cross correlation

Started by Craig May 21, 2005
Can anyone give me a pointer to tutorials on cross correlation and matched 
filters.

I have a repeating pattern in a signal, represented by a, and the pattern 
that I would like to identify is represented by b, I use xcorr(a,b) in 
matlab but the result appears nothing like expected. "a" is 20000 samples 
and "b" is 150 samples, padded with zeros to 20000. I have referred to a 
couple of books, but neither seems to give the full picture.

Regards,

Craig. 


"Craig" <craigrafferty@blueyonder.co.uk> wrote in message 
news:DTGje.71875$a9.53767@fe3.news.blueyonder.co.uk...
> Can anyone give me a pointer to tutorials on cross correlation and matched > filters. > > I have a repeating pattern in a signal, represented by a, and the pattern > that I would like to identify is represented by b, I use xcorr(a,b) in > matlab but the result appears nothing like expected. "a" is 20000 samples > and "b" is 150 samples, padded with zeros to 20000. I have referred to a > couple of books, but neither seems to give the full picture. > > Regards, > > Craig.
Craig, If I may paraphrase the situation: You have a signal "a" in which there is a repeating pattern "b". We don't know if "repeating" for "b" means that it happens more than once, "repeating" at random intervals in "a" or if it means that it repeats at regular intervals in "a". What is it in the cross correlation that you find surprising? There should be a peak in the cross correlation at those times where "b" occurs as long as the signal (b) to noise (a-B) is adequate (where B is the composite of all occurrences of b). Why did you zero-pad b? I believe it's unecessary unless you intend to use frequency domain multiplication. Did you Google on "cross correlation"? There's a lot of information on the web. Fred
"Fred Marshall" <fmarshallx@remove_the_x.acm.org> wrote in message 
news:<mPednU91qYXdxxLfRVn-2Q@centurytel.net>...

>
> "Craig" <craigrafferty@blueyonder.co.uk> wrote in message
> news:DTGje.71875$a9.53767@fe3.news.blueyonder.co.uk...
> > Can anyone give me a pointer to tutorials on cross correlation and
> > matched filters.
> >
> > I have a repeating pattern in a signal, represented by a, and the
> > pattern that I would like to identify is represented by b, I use
> > xcorr(a,b) in matlab but the result appears nothing like expected.
> > "a" is 20000 samples and "b" is 150 samples, padded with zeros to
> > 20000. I have referred to a couple of books, but neither seems to give > > the full picture.
> >
> > Regards,
> >
> > Craig.
>
> Craig,
>
> If I may paraphrase the situation:
> You have a signal "a" in which there is a repeating pattern "b".
> We don't know if "repeating" for "b" means that it happens more than
> once, "repeating" at random intervals in "a" or if it means that it
> repeats at regular intervals in "a".
>
"b" repeats at regular intervals in "a"
> What is it in the cross correlation that you find surprising?
> There should be a peak in the cross correlation at those times where "b"
> occurs as long as the signal (b) to noise (a-B) is adequate (where B
> is the composite of all occurrences of b).
>
It looked weird because I ended up with 40000 samples, the last 20000 of which had a zero value. It turns out that it was probably the scaling that was causing the problem because when I reversed "b" and used the Matlab conv(a,b) function, I got the expected result. Incidentally, this gave the same result as the first 20000 values using xcorr(a,b), when "b" wasn't reversed.
> Why did you zero-pad b? I believe it's unecessary unless you intend
> to use frequency domain multiplication.
>
It seemed like the right thing to do at the time.
> Did you Google on "cross correlation"? There's a lot of information
> on the web.
>
> Fred
>
I did have a search but I am not by any means competent in DSP so little differences between the presentation on different sites seemed to add to my confusion, though I seem to have a result that I am happy with now. Regards, Craig.
Craig wrote:

> Can anyone give me a pointer to tutorials on cross correlation and matched > filters.
http://www.dspguide.com/ best regards Andreas -- Andreas H&#2013266172;nnebeck | email: ah@despammed.com ----- privat ---- | www : http://www.huennebeck-online.de Fax/Anrufbeantworter: 0721/151-284301 GPG-Key: http://www.huennebeck-online.de/public_keys/andreas.asc