Align and subtract similar signals
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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
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?
Respuestas (0)
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!