很可能我现在让自己看起来非常愚蠢但是以下是从fft自相关得到间隔[1,-1]缩放输出的正确方法吗?缩放应该是numpy.correlate(x,x,mode ="same")将结果缩放到[1,-1]间隔.
def autocorrelate(x):
fftx = fft(x)
fftx_mean = np.mean(fftx)
fftx_std = np.std(fftx)
ffty = np.conjugate(fftx)
ffty_mean = np.mean(ffty)
ffty_std = np.std(ffty)
result = ifft((fftx - fftx_mean) * (ffty - ffty_mean))
result = fftshift(result)
return [i/(fftx_std * ffty_std) for i in result.real]
Run Code Online (Sandbox Code Playgroud)
我已经运行了一些测试数据,它确实看起来它应该做它应该但我不完全确定我没有搞砸了什么,只是偶然得到一些正确的结果;)