フィルターのクリア

Sync data with two sync points

1 回表示 (過去 30 日間)
youngz
youngz 2017 年 5 月 11 日
回答済み: Jan 2017 年 5 月 11 日
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 件のコメント
Jan
Jan 2017 年 5 月 11 日
What exactly is "resyncing"? I could guess, but you do know exactly, what you want.

サインインしてコメントする。

採用された回答

Jan
Jan 2017 年 5 月 11 日
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.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLanguage Fundamentals についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by