MATLAB: Signal Processing – Cross-Correlation to obtain Lag times – further question related to previous answer

xcorr time lag

Hi,thank you for your answer, the sampling frequency was as follows: fs=1000; dt=1/fs; Tg=(length(RGMax)-1)*dt; tm=(0:dt:Tg);
The idea is for the xcorr function to give the time lag that exists when the two signals are maximally correlated. The aim of the analysis is to investigate whether the time lag decreases following a period of motor learning.
How does this relate to the sampling interval?

Best Answer

Hi Trudy,
The answer below should be helpful.
Basically, the xcorr gives you the lag in number of samples. If you multiply number of samples with the sampling interval, you got the time.
HTH