xcorr vs conv: in latest MATLAB version

Hello, I get xcorr(x,y)=conv(x,fliplr(y)) when using the latest MATLAB edition. Has the defintion of xcorr(x,y) changed to xcorr(l)=summation(x(n),y(n-l)) in the latest version? I understand that in the older version, it used to be xcorr(l)=summation(x(n),y(n+l)) Kindly clarify. Thanks very much

1 comentario

hudieliu
hudieliu el 29 de Sept. de 2017
Editada: hudieliu el 29 de Sept. de 2017
If length(x)==length(y),then xcorr(x,y)=conv(x,fliplr(y)) ,and length(xcorr(x,y))= length(x)*2-1. But if length(x)~=length(y), then they are not equal, and length(xcorr(x,y)) = 2*max(length(x),length(y))-1 while length(conv(x,y)) = length(x)+length(y)-1

Iniciar sesión para comentar.

 Respuesta aceptada

David Young
David Young el 27 de Feb. de 2011

0 votos

Surely the definition of xcorr was, and still is, the final formula you give (with the + sign in the index), and this is consistent with xcorr(x,y) = conv(x, fliplr(y)) because convolution is defined by the formula with the - sign in the index.
Correlation and convolution are both operations with standard definitions generally accepted by mathematicians. I don't have the Signal Processing Toolbox, but I can't imagine that MATLAB would ever have implemented anything other than the standard operations.

Más respuestas (1)

Andreas Goser
Andreas Goser el 27 de Feb. de 2011

0 votos

I could not find a change documented in the release notes - compatibility considerations. I assume that you ask this question not out of curiosity, but have different results in different releases? In this case, please post this as a new question with example data and information about releases and platforms you use.

1 comentario

Aprameya
Aprameya el 27 de Feb. de 2011
Andreas,
Thank you very much for the response. I am using this for a project and am not able to find any difference between xcorr and conv(fliplr). However, the info regarding older version was mentioned by a user who had used prior edition of MATLAB - where he was seeing the difference between the two in terms of sign of the lagindex (mentioned in my earlier question). If I can get access to the prior edition (which carried a different definition of the xcorr), I will post both the results.
Thanks again

Iniciar sesión para comentar.

Preguntada:

el 26 de Feb. de 2011

Editada:

el 29 de Sept. de 2017

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by