Cross Correlation - phase or magnitude or both?
- From: "martini" <rdm186@xxxxxxx>
- Date: Wed, 26 Apr 2006 11:20:26 -0500
I have written a cross correlation algorithm which is giving me quite a few
problems. From what is looks like, and from the descriptions of cross
correlation on this site are telling me, i think i found the
problem...however I cant think of how to fix it. Hopefully you can help.
Here is the situation which has been described in more details in other
threads.
I have a template of data, of length N.
I have a sample of data of length M, with N>>M
I need to find where the sample data best fits on the template data - so I
am using the FFT method of cross correlation to find the timeshift which
best matches the data. Here is the problem:
It seems that by this description of the cross correlation:
"You slide one function over the other, one sample at a time, and at
each slid point you:
- multiply corresponding samples of each function
- sum all those products
Summing the prducts is like taking the area under the resulting curve
of the products.
Now, if the signals are similar, and unslid, then their products will
be like squaring one signal - which will all be positive going, so the
area under this curve wil all add (constructive interefernce -
remember physics of waves?) and so will be big. If the signals are not
similar, or are slid, then some positive signal samples will multiply
negative signal samples, so some of the resulting product samples will
be negative, and these negative going parts of the curve will subtract
from the positive parts (destructive interference) so the area will be
less."
that if the signals are of different magnitude, they can still have a very
good correlation. Take for example the plot shown here:
http://www.personal.psu.edu/rdm186/random_images/phase_mag.jpg
Red section is the template data, and the green/blue sections are the
sample data timeshifted. The green sample, is the timeshift corresponding
to the highest correlation via the FFT method, whereas the blue section is
where it actually fits the best.. you can see that the phases are VERY
similar in these two sections of the template, however the section where
the FFT returned the highest correlation has considerably different
magnitudes. However, from the above description, it makes sense that the
FFT would return this as the highest correlation, because the
multiplication of the two data sets at this section of the curve would
yield a higher product than at the 'correct' section of the curve - since
the template data has a higher magnitude at this point.
Is there a way to consider magnitudes with xcorrelation?
.
- Follow-Ups:
- Re: Cross Correlation - phase or magnitude or both?
- From: Rune Allnor
- Re: Cross Correlation - phase or magnitude or both?
- From: Ikaro
- Re: Cross Correlation - phase or magnitude or both?
- Prev by Date: Re: frequency modulation
- Next by Date: Re: Is there an actual definition for "direction of arrival"?
- Previous by thread: Upsampling and Interpolation for TDOA Correlation
- Next by thread: Re: Cross Correlation - phase or magnitude or both?
- Index(es):
Relevant Pages
|