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

조회 수: 1 (최근 30일)
badr
badr 2013년 10월 12일
답변: badr 2013년 10월 12일
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
Matt J
Matt J 2013년 10월 12일
Please apply the
formatting button to your code to make it readable.

댓글을 달려면 로그인하십시오.

답변 (2개)

badr
badr 2013년 10월 12일
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
Image Analyst
Image Analyst 2013년 10월 12일
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.

댓글을 달려면 로그인하십시오.


badr
badr 2013년 10월 12일
sorry i attached the .m file

카테고리

Help CenterFile Exchange에서 Correlation and Convolution에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by