xcorr function doesnt change its max. even i delayed the signal

1 visualización (últimos 30 días)
badr
badr el 12 de Oct. de 2013
Respondida: badr el 12 de Oct. de 2013
Hi, Iam trying to do some stuff about calculating the delay between two signals by using the difference between the two max.'s of the correlation functions that will be calculated so, i wrote a small code:
>> a=[ones(1,5),zeros(1,5),ones(1,5),zeros(1,5),ones(1,5),zeros(1,5)]; >> plot(a); >> plot(b); >> b=[zeros(1,26),ones(1,5),zeros(1,5),ones(1,5),zeros(1,5),ones(1,5),zeros(1,5)]; >> plot(b); >> c=[zeros(1,30),ones(1,5),zeros(1,5),ones(1,5),zeros(1,5),ones(1,5),zeros(1,5)]; >> plot(c); >> plot(xcorr(a,c)); >> plot(xcorr(a,b));
now xcorr(a,c) is the same of xcorr(a,b) despite of the predicted result of xcorr(a,c) is that it will be shifted by 3 from xcorr(a,b
PLZ, can any one help me in this ?
THNX for reading.

Respuestas (2)

badr
badr el 12 de Oct. de 2013
if true
>> a=[ones(1,5),zeros(1,5),ones(1,5),zeros(1,5),ones(1,5),zeros(1,5)]; >> plot(a); >> plot(b); >> b=[zeros(1,26),ones(1,5),zeros(1,5),ones(1,5),zeros(1,5),ones(1,5),zeros(1,5)]; >> plot(b); >> c=[zeros(1,30),ones(1,5),zeros(1,5),ones(1,5),zeros(1,5),ones(1,5),zeros(1,5)]; >> plot(c); >> plot(xcorr(a,c)); >> plot(xcorr(a,b));
end
sorry for that
  1 comentario
Image Analyst
Image Analyst el 12 de Oct. de 2013
You'd get more enthusiastic help if you made it easier for us, like don't have the if true stuff in there (you probably clicked {}Code before you pasted in the code instead of afterwards), and don't have >> and make it just commands like we can copy and paste into an m-file script.

Iniciar sesión para comentar.


badr
badr el 12 de Oct. de 2013
sorry i attached the .m file

Community Treasure Hunt

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

Start Hunting!

Translated by