Align and subtract similar signals

조회 수: 2 (최근 30일)
Ni Wi
Ni Wi 2018년 3월 3일
댓글: Jyotish Robin 2018년 3월 19일
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
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개)

카테고리

Help CenterFile Exchange에서 Correlation and Convolution에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by