Effacer les filtres
Effacer les filtres

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

1 vue (au cours des 30 derniers jours)
badr
badr le 12 Oct 2013
Réponse apportée : badr le 12 Oct 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.
  1 commentaire
Matt J
Matt J le 12 Oct 2013
Please apply the
formatting button to your code to make it readable.

Connectez-vous pour commenter.

Réponses (2)

badr
badr le 12 Oct 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 commentaire
Image Analyst
Image Analyst le 12 Oct 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.

Connectez-vous pour commenter.


badr
badr le 12 Oct 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