Filter löschen
Filter löschen

Sync data with two sync points

1 Ansicht (letzte 30 Tage)
youngz
youngz am 11 Mai 2017
Beantwortet: Jan am 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 Kommentar
Jan
Jan am 11 Mai 2017
What exactly is "resyncing"? I could guess, but you do know exactly, what you want.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Jan
Jan am 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.

Weitere Antworten (0)

Kategorien

Mehr zu Language Fundamentals finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by