Effacer les filtres
Effacer les filtres

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

1 vue (au cours des 30 derniers jours)
horizon
horizon le 25 Avr 2019
Modifié(e) : horizon le 25 Avr 2019
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]);

Réponses (0)

Catégories

En savoir plus sur Calendar dans Help Center et File Exchange

Produits


Version

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by