How can I overlap two sets of data with different time durations?

2 views (last 30 days)
I have two data sets (acceleration, force) that start at different times (ie. acc starts at 0.25s and force starts at 1.5s) and I want to develop a code that will read these two data sets and plot the two, one on top of another, by zeroing the start time (ie instead of starting at 0.25s and 1.5s they both start at 0s) so the pulses for each will be right on top of another. The problem is I do not know the exact time each one of the data sets start at, so is there a way that matlab can figure that out?
Thank you for any help.
  1 Comment
dpb
dpb on 23 Jul 2014
How's the data encoded, particularly the time?
Is there a pretrigger set of data of some varying length before the beginning of the transient or is that in the collection device so the actual data are at the beginning of your data records?

Sign in to comment.

Answers (1)

Star Strider
Star Strider on 23 Jul 2014
If you have the Signal Processing Toolbox, the pulses are relatively well-defined peaks (and preferably your signal is not excessively noisy), you can use the findpeaks function to locate them in each signal. Then use the ‘locs’ (peak index) output of findpeaks of both to synchronise the times of the first pulses. That may not give you the start times of both signals, but you will be able to align the peaks.

Community Treasure Hunt

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

Start Hunting!