I'm going through the Think DSP by Allen B. Downey, and I'm struggling to understand a specific aspect of np.correlate and how it differs from statistic autocorrelation. The question is at the bottom, but to give it here: why does the magnitude of autocorrelation drop off at periodic intervals of time shift using np.correlate but not the statistical autocorrelation function (pearson product)?

The presented signal is

enter image description here

Using statistical autocorrelation, which I believe normalizes the signal and unbiases it, it looks like: enter image description here

Using np.correlate(signal, signal, "same") I get enter image description here

The book mentions that "you’ll notice that the correlations computed by np.correlate get smaller as the lags increase. That’s because np.correlate uses the unstandardized definition of correlation; as the lag gets bigger, the number of points in the overlap between the two signals gets smaller, so the magnitude of the correlations decreases." - This is the part I do not understand. It's effectively a periodic signal, so why does the number of overlapping points get smaller with greater time shift? At some point the shift matches the period, and the correlation should be near 30 again? Does it have something to do with the lack of normalization in the latter?


The difference here is that statistical autocorrelation assumes a stationary power signal (so basically an infinite periodic signal) and does a normalisation to $[-1,1]$ and that autocorrelation just takes the finite signal as it is and does the classical convolution of the signal with itself, leading to just one point of perfect overlap and decreasing amplitudes before and after.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.