Effacer les filtres
Effacer les filtres

Sync data with two sync points

1 vue (au cours des 30 derniers jours)
youngz
youngz le 11 Mai 2017
Réponse apportée : Jan le 11 Mai 2017
Hi, I have two signal recorded by two different devices (with different clock). In addition, this signals can have two different "time" length. Anyway, I have two data (in the middle of the signal) that can be used to sync them (interpolating the smaller one).
As example, you can consider the data generated by this code:
a = [(1:1000)' (zeros(1,1000))'];
b = [(1:3500)' (zeros(1,3500))'];
a(500,2) = 1; %Starting sync point
a(750,2) = 2; %Ending sync point
b(640,2) = 1; %Starting sync point
b(1020,2) = 2; %Ending sync point
Where the value 1 defines the "first" sync point, and 2 defines the "second" sync point.
There is a Matlab method able to resync these data?
Thanks
  1 commentaire
Jan
Jan le 11 Mai 2017
What exactly is "resyncing"? I could guess, but you do know exactly, what you want.

Connectez-vous pour commenter.

Réponse acceptée

Jan
Jan le 11 Mai 2017
At first determine the factor between the time steps:
a1 = find(a(:, 2) == 1);
a2 = find(a(:, 2) == 2);
b1 = find(b(:, 2) == 1);
b2 = find(b(:, 2) == 2);
aInt = a2 - a1;
bInt = b2 - b1;
abFactor = bInt / aInt;
Now you can scale the times:
aTime = (0:size(a, 1) - 1) * abFactor;
bTime = 0:size(b, 1) - 1;
Now you can calculate initial and final time frame of a related to b. You see that this is simple arithmetics, so I leave this up to you.

Plus de réponses (0)

Catégories

En savoir plus sur Language Fundamentals dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by