1

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

  • 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 http://stats.stackexchange.com/questions/81754/understanding-this-acf-output, which also deals with variations in how cross- and auto-correlation functions are computed. – whuber Feb 25 '14 at 22:32
  • This question appears to be off-topic because it is about how MATLAB functions work. – gung - Reinstate Monica Feb 25 '14 at 22:48
  • Thank you very much whuber, but I still can't figure it out. Gung, I hope It isn't off-topic. –  Feb 25 '14 at 23:11

1 Answers1

0

(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

panthyon
  • 116
  • 3
  • 1
    This looks helpful--but how does it answer the question? – whuber Feb 25 '14 at 23:22
  • 1
    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. –  Feb 25 '14 at 23:30
  • 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. – panthyon Feb 25 '14 at 23:48