Borrar filtros
Borrar filtros

Sync data with two sync points

1 visualización (últimos 30 días)
youngz
youngz el 11 de Mayo de 2017
Respondida: Jan el 11 de Mayo de 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 comentario
Jan
Jan el 11 de Mayo de 2017
What exactly is "resyncing"? I could guess, but you do know exactly, what you want.

Iniciar sesión para comentar.

Respuesta aceptada

Jan
Jan el 11 de Mayo de 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.

Más respuestas (0)

Categorías

Más información sobre Language Fundamentals en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by