import numpy as np
import matplotlib.pyplot as plt
def xcorr(x,y):
result = np.correlate(x, y, mode='full')
return result[result.size/2:]
a = np.random.rand(1000)+ 40
plt.plot(xcorr(a,a))
plt.show()
Why this code give a straight line with downward slope?
I thought autocorrelation of a shouldn't be a straight line...
Is this the wrong way to get autocorrelation with numpy?
I was using this: How can I use numpy.correlate to do autocorrelation?
But.. numpy.correlate([4,4,4],[4,4,4],"full") gives array([16, 32, 48, 32, 16])
numpy version is 1.8.1
Thanks a lot for help.