align two signals for temporal synchronization

hi. I have two signals which are attached. the first one has 9 samples and the other has 44 samples. i want to find the corresponding samples between these 2 signals whit the knowledge that i know the correspondings of 5 samples. for example i know the sample 5 from signal 1 is corresponds to sample 25 of signal2, the sample 3 from signal 1 is corresponds to sample 9 of signal2, the sample 4 from signal 1 is corresponds to sample 18 of signal2, the sample 8 from signal 1 is corresponds to sample 32 of signal2, the sample 2 from signal 1 is corresponds to sample 6 of signal2.
there are 4 samples left in signal 1 that i want to find theire corresponding samples in signal2
can anyone help me to fine the best alignment of these 2 signals with those 5 known landmarks to find the remaining correspondings in order to temporal synchronization of these two signals?
Best Regards

16 Comments

What about the first and last sample from each signal? Do they correspond to eachother as well? If not, that makes the problem a bit more difficult. Another difficulty is that the correspondence (below) are non linear.
%Index of signal1 : signal2
2 6
3 9
4 18
5 25
8 32
190607 100531-Figure 1.jpg
No they dont match. for example the first sample of signal 1 is similar to the third sample of signal 2
exactly the relation ships are non linear because the curves are from the nonlinear motion of heart
The relationship looks sigmoidal. If I were to extend that sigmoid to x=1 it looks like y would equal ~4 or ~5 (intergers required). Is the nonlinearity expected to be signoidal? If so, perhaps you could fit a sigmoid to those indices in order to calculate x = [1,6,7,9] and then round to nearest integer. Would that approach make sense in the context of your data and the relationship between the x and y samples?
there is no information that the relationship should have a sigmoidal behavior. but in the contex of dynamic time warping, it should be a Descending Function, begining from last points and ending to first points
What is a Descending Function? Monotonically decreasing?
Here's an implementation of my idea to fit the data to a sigmoid and it seems to work fairly well (for these data). It uses sigm_fit() from the file exchange.
% Define the known correspondences (shorter signal on left)
cor = [2 6; 3 9; 4 18; 5 25; 8 32];
% Fit the sigmoid
[param, ~] = sigm_fit(cor(:,1),cor(:,2),[],[],false);
% Use the params from the fit to calculate the missing y values
% Round to nearest integer
fsigm = @(param,xval) param(1)+(param(2)-param(1))./(1+10.^((param(3)-xval)*param(4)));
xMissing = [1,6,7,9]; %missing x values
yMissing = round(fsigm(param,xMissing));
% Plot results
figure()
x = 1:.001:9;
plot(x,fsigm(param,x), 'r-', 'DisplayName', 'FitSigmoid')
hold on
plot(cor(:,1),cor(:,2),'ko','LineWidth',2,'DisplayName','KnownCorrespondence')
plot(xMissing,yMissing, 'bx','LineWidth',2,'DisplayName','EstimatedCorrespondence')
legend()
Missing (x,y) values are
%missing x y
1 4
6 30
7 31
9 32
190607 104042-Figure 1.jpg
talayeh ghodsi comment moved here:
the function should have 2conditions:
1) monotonic conditions: Xn >= Xn-1, Yn>=Yn-1
2)continuity condition: Xn-Xn-1<=1 , Yn-Yn-1<=1
The second condition is true for any vector. Any vector minus itself (piecewise) will always be less than 1 (it will be 0). The first condition is that the the indices are monotonically increasing.
thanks a lot for your attention. but the consecutive 31,32,33 for the samples 6,7,9 can not be correct. is there any solution to have a function whit a higher slop at the end of the function. for example instead of having 31,32,33, have something like 34,40,43?
Well, you could tweak the sigmoid params but those decisions would be arbitrary and probably not extendable to other data sets. I'm guessing this processes needs done on multiple data sets. Otherwise you could merely guess the 4 missing values.
I have a second thought. In the 2 plots you shared, the x axis is merely the index value of each sample. Were the samples collected over time and if so, do you have the time stamps for each sample? How do you know the correspondences you shared?
maybe explaining 2 plots help. i have 2 series of images. serie1(CT data): 9 images aquired at each 10% of RR interval(sample1: the image of 10% RR,sample2: the image of 20% RR,...,sample9: the image of 90% RR)
serie2(echo data): which is continues in RR interval and is 44 frames
so i want to extrcact 9 of 44 frames of the echo data corresponding to 10%...90%
i draw the manifold of both modalities. so one of the manifolds contain 9 samples and the other contain 44. the plots that i shares previously, are the distance plots of each sample of each manifold from the origin
the manifolds are attached
I don't know what RR is but do you have the RR data for both signals? Does RR (or any other data you have) map onto both signals?
RR interval is the distance between two censecutive R waves in ECG. we have record CT data in every 10% of this interval (9 data points). and we have echo data in all of this interval(44 frames)
Ok, sorry if I'm using the wrong terminology, but correctly me if my understanding is incorrect. You have 10 equally spaced samples of CT data for every RR interval and you've got 44 equally spaced samples of echo data for every RR interval. Is that correct?
Based on the png you shared, I'm imagining 10 samples of CT data within the RR interval and 44 samples of echo data within that same interval. If that's true, and if you have the location (or time?) of the R waves (that define the RR interval) then perhaps you can use those location (or time) values to map the indices between the echo and CT data. Or am I completely lost?
the most problem is because f the nonlinear nature of heart, the RR interval does not divided to 10% intervals linearly in echo data

Sign in to comment.

Answers (0)

Categories

Find more on Signal Processing Toolbox in Help Center and File Exchange

Asked:

on 7 Jun 2019

Commented:

on 7 Jun 2019

Community Treasure Hunt

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

Start Hunting!