xcorr for estimating signal offset

4 Ansichten (letzte 30 Tage)
Graham Watson
Graham Watson am 6 Sep. 2018
I'm trying to use xcorr to estimate the delay between a pair of noisy signals. I've simplified the problem with synthetic data - sig1 & sig2:
The ground-truth shift between the signals is 1000 samples. I'm using a simple processing scheme:
C = xcorr(sig1,sig2);
[mv, mp] = max(C);
mp then gives me the position of the peak cross-correlation, which should, in principle, give me the shift between signals when I subtract 10000.
With the default xcorr, the cross-correlation peak is reported as 10000 - i.e. zero shift between the signals. The 'unbiased' normalisation gives me a peak at 9548, and using 'coeff' takes me back to 10000.
I appear to be missing a trick here. What's happening? Is it some function of the zero padding? Is it that for the example given, over the 10000 samples, the blue signal is actually longer than the red?
Interestingly, I converted the test signals into triangular pulses:
Now, everything works just fine - the peak in the cross-correlation curve is at 9000, indicating the correct 1000 sample shift. This works for all xcorr normalisations.
Any clues or pointers would be most welcome!

Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by