Borrar filtros
Borrar filtros

xcorr zero lag

13 visualizaciones (últimos 30 días)
Diego
Diego el 1 de En. de 2012
Dear all, How can I use xcorr for 0 lags? In the test I'm running I don't want to 'slide' one sequence over another but keep them fixed. Thanks in advance. Happy new year! Diego
  3 comentarios
Diego
Diego el 1 de En. de 2012
I'm correlating sequences of length 8.
Is this right?
Thanks,
Diego
the cyclist
the cyclist el 1 de En. de 2012
I don't have the Signal Processing Toolbox, so I can't check myself, but the syntax in your first comment looks right to me. Can you give a more complete example of the code you have written, the result, and why specifically you believe it to be wrong (or not what you expect)?

Iniciar sesión para comentar.

Respuestas (1)

Wayne King
Wayne King el 1 de En. de 2012
Hi Diego, Why doesn't this work?
[c,lags] = xcorr(randn(1000,1),rand(1000,1),0,'coeff');
This gives you exactly what you have described; the cross correlation between two input vectors at zero lag.
c is the value of the normalized cross correlation sequence at zero lag.
  4 comentarios
Diego
Diego el 1 de En. de 2012
ughh I'm so sorry for omitting the information... the code just grows a lot and is a little messy at this time.
P and Q are the same length.
Thanks for your patience!
P=[M(l,i:i+rep-1)];
Q=[M(z,j:j+rep-1)];
[m,d]=max(X1);
Diego
Diego el 3 de En. de 2012
It seems the problem was using the 'delay' for plotting.
I just removed it since at 0 lags it seems to be useless and the plot works as expected.
Many thanks,
Diego

Iniciar sesión para comentar.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by