我想对下面显示的信号执行自相关.两个连续点之间的时间是2.5ms(或400Hz的重复率).

这是我想要使用的估计自相关的等式(取自http://en.wikipedia.org/wiki/Autocorrelation,部分估计):

在python中查找我的数据估计自相关的最简单方法是什么?有什么类似于numpy.correlate我可以使用的东西吗?
或者我应该只计算均值和方差?
编辑:
from numpy import *
import numpy as N
import pylab as P
fn = 'data.txt'
x = loadtxt(fn,unpack=True,usecols=[1])
time = loadtxt(fn,unpack=True,usecols=[0])
def estimated_autocorrelation(x):
n = len(x)
variance = x.var()
x = x-x.mean()
r = N.correlate(x, x, mode = 'full')[-n:]
#assert N.allclose(r, N.array([(x[:n-k]*x[-(n-k):]).sum() for k in range(n)]))
result = r/(variance*(N.arange(n, 0, -1)))
return result
P.plot(time,estimated_autocorrelation(x))
P.xlabel('time (s)')
P.ylabel('autocorrelation')
P.show()
Run Code Online (Sandbox Code Playgroud)