Clear Filters
Clear Filters

Cross correlation of peaks for time delay

4 views (last 30 days)
Hi,
i got two signals from an acceleration sensor, which show dominant peaks. The time delay between those peaks is of interest. I´m able to detect the peaks in the signal but when I try to find out the delay via xcorr I often get a lag of zero. I know they signals are not quite similar, but in a way it must be possible to detect the lag. I think I make a simple mistake, because when I choose a longer signal section for one signal I got lags different from zero for the majority of the peaks.
For a better understanding of the concrete problem I have a test case:
[r,lag]=xcorr(S1(268500:269400),S2(268500:269400));
[~,max]=max(abs(r));
lagDiffTest=lagTest(max);
--> resulting in zero lag
[r,lag]=xcorr(S1(268500:269600),S2(268500:269400));
[~,max]=max(abs(r));
lagDiffTest=lagTest(max);
--> resulting in a lag of 24 (which seems to fit considering the time delay (calculated with respect to the sampling frequency) on the rising and falling edge )
  1 Comment
Harwanto Zidqi Putro
Harwanto Zidqi Putro on 31 Aug 2020
Edited: Harwanto Zidqi Putro on 31 Aug 2020
Im facing with same problem. I hope someone explanation about this

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!