How to determine time lag by using xcorr ?
이전 댓글 표시
Hello everyone,
I am trying to determine the time lag between two signals delayed with the function xcorr but I'm not sure I'm doing it the right way.
Here's the code that i am using:
[cor,lag]=xcorr(SIGNAL,SIGNAL2);
[~,I]=max(abs(cor));
lagDiff=lag(I);
Time_Diff=lagDiff*DT;
Where DT is the sampling time in sec,
I am not sure si Time_Diff is giving the real time Lag between the two signals.
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Correlation and Convolution에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!