Autocorrelation of a sine wave I would like to know the meaning of an autocorrelation graph of a sine wave. When the time lag is 0, then the autocorrelation should give the highest value of 1 since a copy of the signal is completely correlated to itself. By this logic, after a time equal to the period of the signal, the correlation should again be maximum since the shifted signal is again the signal itself. However, when I plot the correlation in python, I get a function which keeps increasing which goes against my intuition that the correlation function should be periodic. Can anyone please explain why the autocorrelation shows this trend in its graphical form?

import matplotlib.pyplot as plt
import numpy as np
time = np.arange(0, 10, 0.1);
y = np.sin(time)
result = np.correlate(y, y, mode='full')
plt.plot(result[:int(result.size/2 )])
plt.show()
You actually do not have a problem here. The way np.correlate is implemented, you get the negative delay values first. If you plotted your entire signal, it would look as expected. Run plt.plot(result) and you will get



The maximum is at 100 and represents zero delay. That the maximum is so high, is because np.correlate does not normalize the function, but just computes the sum, as you can see in the documentation


  This function computes the correlation as generally defined in signal
  processing texts:
  
  c_{av}[k] = sum_n a[n+k] * conj(v[n])
  
  with a and v sequences being zero-padded where necessary and conj
  being the conjugate.


That the acf decays for your signal and for delays larger or smaller than zero is due to its finite length. For an infinite signal, you would be able to see the periodicity without decay.