Filter löschen
Filter löschen

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

1 Ansicht (letzte 30 Tage)
badr
badr am 12 Okt. 2013
Beantwortet: badr am 12 Okt. 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.

Antworten (2)

badr
badr am 12 Okt. 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 Kommentar
Image Analyst
Image Analyst am 12 Okt. 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.

Melden Sie sich an, um zu kommentieren.


badr
badr am 12 Okt. 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