This is not a bug in Signal Processing Toolbox 6.0 (R13). XCORR calculates the correlation between two vectors. XCORR does not require the input vectors to have a zero mean. The limitation of zero mean sequences would require the autocorrelation and cross-correlation to be identical to the autocovariance and cross-covariance respectively. Recall that:
Cxx(t,u)=Rxx(t,u)+E[x(t)]E[x(u)],
where Cxx is the autocovariance and Rxx is the autocorrelation of the process, X.
However, this is not always the case. As a workaround, you can pre-process your input vector and subtract its mean before passing it as an input of XCORR, as in the following example:
x=rand(1,1000);
x=x-mean(x);
[Rx, lags]=xcorr(x,'coeff');
plot(lags,Rx);
Best Answer