How to find starting point of one signal in another?

8 次查看(过去 30 天)
I have 2 signals that have the same sampling frequency (100 Hz), but one began recording before the other. I'm trying to find the size of this delay (# of indices/sample points) so I can align the signals.
I have tried using the 'alignsignals' function, but the delay it gives me is clearly to big, and when I manually try to find a matching point in the two signals and subtract one from the other to find the delay, it still doesn't seem to give me an accurate delay. I've also tried using xcorr but it's giving me the same delay as the alignsignals function whic again, seems to big.
Does anyone have any suggestions or know what I might be doing wrong? Signals attached.
Thank you.
  3 个评论
Maria Y
Maria Y 2020-1-10
Hi Adam,
Thanks for your response. I am trying to find where in the red signal the blue signal is located. x=0 to x=~2.25 is the entire signal I'm looking for.
If you zoom into the red signal from ~x=1 to the end, you'll see that visually the signals look the same (which they should because they are both foot position data from the same system recording the exact same events at the same time, the blue signal just started slightly after the red). So visually I can see they start lining up around ~x=1 but I'm trying to find the exact indice in which this happens.
Adam Danz
Adam Danz 2020-1-10
编辑:Adam Danz 2020-1-10
"you'll see that visually the signals look the same "
I admitt that I haven't zoomed in to the data but when I plot the data on the same axes so we get a sense of scale, it's hard to imagine that the signals will look the same, even if I imagine that one is shifted relative to the other. As I mentioned before, the vicon data are magnitudes larger than the task data.
clf()
plot(task_left_foot,'b-')
hold on
plot(vicon_left_foot, 'r-')
They are both labeled "left_foot". Could it be that the wrong data were attached?

请先登录,再进行评论。

回答(1 个)

Pablo Fernandez
Pablo Fernandez 2020-1-22
Try the findsignal function:
load('task_left_foot.mat');
load('vicon_left_foot.mat');
findsignal(vicon_left_foot,task_left_foot)
findsignal.png
  2 个评论
Maria Y
Maria Y 2020-1-22
Thank you Pablo. Sorry I meant to follow up on this post - I realized there were some missing data points in one of the signals which is why functions such as findsignal weren't working. Figured it out now.
Thanks again.
Maria
Pablo Fernandez
Pablo Fernandez 2020-1-22
Good to hear you solved your problem. I did notice that alignsignals gives a different, less correct answer.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Measurements and Feature Extraction 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by