What is "lagDiff" on MATLAB to evaluate the time difference from the cross-correlation ?

조회 수: 4 (최근 30일)
This is the sample program from MATLAB Documentation for xcorr and I'm troubled with understanding what lagDiff means on it.
I've checked the page which explains lag function on MATLAB, but still it is difficult to understand the meaning of "one time step".
load sensorData
t1 = (0:length(s1)-1)/Fs;
t2 = (0:length(s2)-1)/Fs;
subplot(2,1,1)
plot(t1,s1)
title('s_1')
subplot(2,1,2)
plot(t2,s2)
title('s_2')
xlabel('Time (s)')
[acor,lag] = xcorr(s2,s1);
[~,I] = max(abs(acor));
lagDiff = lag(I)
timeDiff = lagDiff/Fs
figure
plot(lag,acor)
a3 = gca;
a3.XTick = sort([-3000:1000:3000 lagDiff]);

답변 (0개)

카테고리

Help CenterFile Exchange에서 Axis Labels에 대해 자세히 알아보기

제품


릴리스

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by