MATLAB Answers

How to synchronize two datasets with different AND varying sampling rate?

10 views (last 30 days)
Micke Malmström
Micke Malmström on 4 Nov 2017
Edited: Micke Malmström on 4 Nov 2017
I have the data sets, Data1 and Data2 like below:
Data1.t % vector with timestamps e.g. [0.1, 0.4 2 2.3 4 4.5 4.7 etc...]
Data1.data % The voltage measured of a 0.1 Hz triangle function at the times specified above.
and:
Data2.data % the same 0.1 Hz triangle function but measured at different times than in Data1.t
The problem is that I want to figure out the time at which Data2 was sampled, i.e. Data2.t (there is at least 10 samples per period)
I was thinking of using something like
Data2.t=interp(Data1.data(start_index_n:stop_index_n),...
Data1.t,...
Data2.data(start_index_n:stop_index_n))
If I'm lucky I can find the
start_index_n
for each period "n" in both Data1.data and Data2.data with some peakfinder-function… and then cycle through all the recorded periods.
(I started writing this as a question but as I was writing I realised how I could approach the problem. So this post is mainly to help others)

Answers (0)

Tags

Products

Community Treasure Hunt

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

Start Hunting!

Translated by