1
$\begingroup$

What is the difference between:

  • 1) xcov(x,y,10,'unbiased')/sqrt(xcov(x,x,0,'unbiased')*xcov(y,y,0,'unbiased'));
  • 2) xcorr(x,y,10,'unbiased');
  • 3) [A, B] = crosscorr(x,y,10);

?

I think (but I am not sure) that "crosscorr" removes the means and "xcorr" doesn't, but i don't get why the first one gives a completely different answer compared to the others. Am I using a wrong formula in 1)?

Thank you very much

$\endgroup$
3
  • $\begingroup$ I haven't studied the Matlab algorithms, so I don't know what it's doing, but I'm wondering whether your question might be related to the one at stats.stackexchange.com/questions/81754/…, which also deals with variations in how cross- and auto-correlation functions are computed. $\endgroup$
    – whuber
    Feb 25, 2014 at 22:32
  • $\begingroup$ This question appears to be off-topic because it is about how MATLAB functions work. $\endgroup$ Feb 25, 2014 at 22:48
  • $\begingroup$ Thank you very much whuber, but I still can't figure it out. Gung, I hope It isn't off-topic. $\endgroup$
    – user40899
    Feb 25, 2014 at 23:11

1 Answer 1

0
$\begingroup$

(For binaural hearing research), I have never used crosscorr(), only xcorr() with the number of lags (i.e. the amount you want to "shift" one of the signals in each direction to calculate the cross correlation coefficient at each point -- the measure of similarity) equal to the duration of the signal (in seconds) times the sampling rate of your signal.

however, it is a bit more difficult to eyeball an interpretation of xcorr(), so I often use a normalized xcorr() function called ncorr(). In GNU Octave normalized xcorr can be called by passing the "coeff" option to xcorr2() in the signal package or for Matlab the variety of normalization options for the xcorr function: http://www.mathworks.com/help/signal/ref/xcorr.html

$\endgroup$
3
  • 1
    $\begingroup$ This looks helpful--but how does it answer the question? $\endgroup$
    – whuber
    Feb 25, 2014 at 23:22
  • 1
    $\begingroup$ Thank you very much for the explanation of xcorr()! Do you know why I get a different output in 1) ? From the documentation I have understood that xcorr and xcov should be very related. $\endgroup$
    – user40899
    Feb 25, 2014 at 23:30
  • $\begingroup$ xcov() operates exactly like cross correlation except it applies a penalty to any signal with extreme values by removing the mean from the sampled data. $\endgroup$
    – panthyon
    Feb 25, 2014 at 23:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.