在使用 matplotlib.mlab.psd() 函数时,开发人员发现返回的频率箱似乎不正确。
以下是测试代码:
import matplotlib.mlab as ml
import numpy as np
sampf = 500.
nfft = 2**4
testdat = np.random.randn(10000,)
p2, f2 = ml.psd(testdat, nfft, sampf, sides='twosided')
p1, f1 = ml.psd(testdat, nfft, sampf, sides='onesided')
print(testdat.shape)
print("Twosided")
print("\tbin1 : {:f} ".format(f2[0]))
print