Solved – Cross-correlation in Matlab

cross correlationeconometricsMATLABself-studytime series

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

Best Answer

(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

Related Question