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

7 ビュー (過去 30 日間)
horizon
horizon 2019 年 4 月 25 日
編集済み: horizon 2019 年 4 月 25 日
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 Center および File ExchangeCalendar についてさらに検索

製品


リリース

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by