Time alignment of two signal with same length

14 ビュー (過去 30 日間)
iker arana
iker arana 2018 年 3 月 20 日
コメント済み: iker arana 2018 年 4 月 10 日
Hello,
I have found information about similar topics, but wasn´t useful for me.
I have the next 2 signals registered by a laser profilometer.
As can be seen in the picture the signals are almost equals but are not in phase. What i need is to displace the red signal over the blue one finding the more likely point of union to get a third signal.
I have tried with this code, but it does not work, i obtain zero in the lag, i suspect that it is caused becouse the signals length is the same.
[acor,lag] = xcorr(p2,p1);
[~,I] = max(abs(acor));
lagDiff = lag(I);
The two signals are attached.
Regards!

採用された回答

Jon
Jon 2018 年 3 月 20 日
編集済み: Jon 2018 年 3 月 20 日
I think the fundamental problem you have with your approach is not that the signals are the same length it is that they contain a strong linear trend (ramp down). In general, to use xcorr to estimate delay between signal the two inputs signals should be stationary (not ramping up or down) and zero mean. Otherwise any constant offset (mean) or ramp which is common to the two signals with a delay of zero, tends to dominate the cross correlation. Conceptually, you can "detrend" the data, fitting a linear (slope + intercept) line through the data and then use xcorr on the residuals (actual - fit). I would have to think a little deeper about this though to know if it really makes sense. My intuition is that whether or not this detrending makes sense or not depends on what is physically going on in your situation. Does the physical delay apply to the ramps too, in which case we should see some offset in the ramps, or is it just applied to the variations from the ramp (in which case the detrending idea perhaps could be justified).
  2 件のコメント
iker arana
iker arana 2018 年 3 月 21 日
編集済み: iker arana 2018 年 3 月 21 日
Hello, i am now trying to delete the trend with the detrend function and the outcomes looks better. I will try with all my serie before accept the answer, but looks good.
Thanks!
iker arana
iker arana 2018 年 4 月 10 日
Hello, i have another similar problem. I am trying to align one of above signal using alignsignal function, but the returned D parameter is not a positive value.
Plotting the signals i obtain.
And making a zoom, can be observed that the signal are not aligned. I designed an algorithm to remove the trend of the blue signal, becouse the detrend function does not works well for non linear trendings. Somebody can help me? the alingsignal function returns me a delay of -84, the same as finddelay function...

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCorrelation and Convolution についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by