xcorr function: want only negative values
Mostra commenti meno recenti
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?
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Correlation and Convolution in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!