How to synchronize two different data sets?

The problem is as follows:
In an experiment two devices are used for measuring for which manual operation is required. This causes the obtained data sets to be out of sync and of different lengths. The question is how to synchronize one of the sets to the other. Below are parts of the plots of both data sets.
Figure 1: Data set A. This data has a lot of noise which will be removed later on, but for now it is important that it won't.
Figure 2: Data set B. This data has an offset, but this shouldn't be a problem for synchronizing.
From the figures it can be seen that there is a clear spike in the data at the beginning of both sets. This has been done on purpose to make the synchronization easier. It's not a problem if the spike isn't used, because it isn't part of the important data. The goal is that each spike in data set A corresponds to the spike in data set B with an error as small as possible. Notice that the heights/values of the sets don't correspond with each other, which is intended. In the end both data sets should have the same length. This probably means that both sets need to be trimmed, resulting in the loss of some data, but that has been taken into account. A few solutions have been tried.
Finding the peaks in each data and than correlate some of the points that were found didn't solve the problem. Also trying to detect when a spike occurred didn't work.
Pleas help solve this problem. Thanks in advance.
Greetings,
Weikang

댓글 수: 4

José-Luis
José-Luis 2012년 12월 20일
편집: José-Luis 2012년 12월 20일
You could write a function that expresses the differences (e.g. squared or absolute values) between the two signals as a function of the offset. Then it would be a matter of minimizing that function.
Jan
Jan 2012년 12월 20일
편집: Jan 2012년 12월 20일
I still do not understand the question. What do you want to synchronize exactly? Is the initial spike the common trigger between the signals? And the amplitude of the signals is not equal?
What was wrong with finding the peaks and correlating their points? There is absolutely no other method to solve this problem. There are a lot of different methods to perform the "correlation", but all valid methods must actually do the same and lead to equivalent results.
And why did tyring to detect when the spike occured did not work? As far as I understand all you want to do is detecting when the spikes occur in the two signals.
Do the 6 trailing bumps matter your problem at all? If not, it is confusing that they appear in the problem description.
Matt J
Matt J 2012년 12월 20일
편집: Matt J 2012년 12월 20일
Finding the peaks in each data and than correlate some of the points that were found didn't solve the problem.
I assume that's because you used the local maximum of each pulse. That would be a bad idea because the locations of maxima are sensitive to noise
Also trying to detect when a spike occurred didn't work.
If you determined the spike locations based on their rising edges, that too would be sensitive to noise and other distortions.
You need a method which incorporates all of the data. Applying a correlator to the entire data set (see my Answer below) would do that.
Weikang
Weikang 2012년 12월 27일
Thank you all for commenting and answering on the problem.

댓글을 달려면 로그인하십시오.

 채택된 답변

Matt J
Matt J 2012년 12월 20일
편집: Matt J 2012년 12월 20일

0 개 추천

The closed form solution to José-Luis' suggestion (for squared differences) is known and is described here
and here

댓글 수: 2

Weikang
Weikang 2012년 12월 27일
Thanks Matt! It took some time to figure out how it worked, but it's exactly what I've been looking for.
Do you remember how did you do it?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Electrophysiology에 대해 자세히 알아보기

질문:

2012년 12월 20일

댓글:

2018년 7월 20일

Community Treasure Hunt

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

Start Hunting!

Translated by