我正在尝试计算时间序列的FFT,它返回以下错误:
ValueError: First argument must be a complex or real sequence of single or double precision
就我而言,我不知道问题出在哪里。我正在尝试将FFT应用于一个非常简单的数组:
print a
# it returns the following
[13.3134 14.7837 15.8005 16.4392 16.77 16.8581 16.7637 16.542 16.2432
15.9124 15.5899 15.0917 14.8813 14.6577 15.0892 15.5698 16.0618 16.5171
16.5566 16.9148 17.0253 16.7795 16.5438 16.3472 16.1904 16.1334 16.1793
16.2207 16.5104 16.3991 16.3626 16.2521 15.9728 15.5024 15.1352 15.1922
15.313 15.5319 15.6566 15.9806 15.9293 15.9144 15.5511 15.1222 14.429
13.536 12.9806 12.2661 11.7088 10.9465 10.3404 10.0313 9.9171 9.8158
9.8581 10.0664 10.3319 10.3305 10.2444 9.9141 9.468 8.8006 8.0059 7.4783
7.2678 7.0964 6.9787 6.6364 6.3546 6.2521 6.0148 6.0349 6.0132 6.0114
6.2272 6.2661 6.5629 6.6819 7.1226 7.5229 7.69 7.4745 6.9349 6.3342
6.0967 5.9438 5.7074 5.3418 5.0442 4.8068 4.6385 4.5081 4.4273 4.336
4.2634 4.2024 4.0722]
import numpy as np
print np.fft.fft(a)
如果我代替该向量生成一个正态分布值的随机序列,那么一切都很好。我的阵列有什么不同?
a的类型为<type 'numpy.ndarray'>
,a [0]的类型为<type 'float'>