Align and subtract similar signals
조회 수: 2 (최근 30일)
이전 댓글 표시
I have two signals (T0 and T1) and want to subtract them from each other:
This code using cross-correlation works for me nearly every time, except in this example:
% find cross-correlation
[acor,lag] = xcorr(T1,T0);
[~,I] = max(abs(acor));
lagDiff = lag(I);
% shift T0 to T1
T0_shifted = circshift(T0,lagDiff);
% stretch T0, so that it meets the height of T1
T0_shifted = T0_shifted * max(T1)/max(T0_shifted);
The signal is shifted to the wrong position, because xcorr() returns a maximum at an unwanted position:
Are there any ways to 'tweak' xcorr() or any alternative methods for aligning graphs?
댓글 수: 1
Jyotish Robin
2018년 3월 19일
I am not quite able to understand why do you think the two signals are similar. From what I see in your figure, the orange signal has an extra heavy bump around x=125. What is your expected shift needed to align the two signals?
답변 (0개)
참고 항목
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!