xcorr function: want only negative values
Ältere Kommentare anzeigen
Hi all,
I have two signals as shown in the attached picture. When I calculate the cross correlation with xcorr, it will sometimes calculate the shift to the left and sometimes to the right. I want the lag to always be negative (so only shifted one direction because the ground truth is that the blue signal always occurs first in real time). I know that there is a 'MAXLAG' option, but it computes the correlation over the range of lags -MAXLAG to MAXLAG (so won't work for my purposes).
In essence, I want the red line to always shift to the left when showing the correction (i.e. the output of the highest correlation), as opposed to the right as shown in the attached image. Does anyone know if this is possible?
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Correlation and Convolution finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!