title: Incorrect autocorrelation of sine wave
body: <p>I'm generating a basic sine wave as follows:</p>
  
  <pre><code>import numpy as np
  x = np.linspace(-10, 10, 200)
  x = np.sin(x)
  </code></pre>
  
  <p>Which looks correct when plotted:</p>
  
  <pre><code>import matplotlib.pyplot as plt    
  plt.plot(x)
  plt.show()
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/A6ssO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/A6ssO.png" alt="enter image description here"></a></p>
  
  <p>But when I try to calculate and plot the normalized autocorrelation of this signal, I get some strange results:</p>
  
  <pre><code>autocorr = np.correlate(x, x, mode='full')    
  autocorr /= autocorr[autocorr.argmax()]  # Normalize autocorrelation
  
  plt.plot(autocorr)
  plt.show()
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/IJQ5t.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IJQ5t.png" alt="enter image description here"></a></p>
  
  <p>Given a sine wave is perfectly periodic, I'm expecting the autocorrelation values to be 1.0 when in phase. However, my autocorrelation peaks get smaller with more time steps</p>
  
  <p>Is there an error in my autocorrelation calculation? Or is there another correlation function I should be using?</p>