align two signals for temporal synchronization
Show older comments
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

talayeh ghodsi
on 7 Jun 2019
talayeh ghodsi
on 7 Jun 2019
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?
talayeh ghodsi
on 7 Jun 2019
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

Adam Danz
on 7 Jun 2019
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
talayeh ghodsi
on 7 Jun 2019
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?
talayeh ghodsi
on 7 Jun 2019
talayeh ghodsi
on 7 Jun 2019
Adam Danz
on 7 Jun 2019
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?
talayeh ghodsi
on 7 Jun 2019
Answers (0)
Categories
Find more on Signal Processing Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!