Align and subtract similar signals

2 visualizaciones (últimos 30 días)
Ni Wi
Ni Wi el 3 de Mzo. de 2018
Comentada: Jyotish Robin el 19 de Mzo. de 2018
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 comentario
Jyotish Robin
Jyotish Robin el 19 de Mzo. de 2018
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?

Iniciar sesión para comentar.

Respuestas (0)

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by