Time alignment of two signal with same length
14 ビュー (過去 30 日間)
古いコメントを表示
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!
0 件のコメント
採用された回答
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 件のコメント
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!