【发布时间】:2019-11-23 22:13:01
【问题描述】:
我尝试使用如下所示的信号制作幅度谱:
为什么我在幅度谱中看不到任何火花?或者我的数据有什么问题?或者为什么峰值只在0?
我使用了一个相当长的数据集,但这里是一个信号样本:
s = [45772.47797743, 45792.20303892, 45772.47797743, 46374.99865567, ... 45671.71873548, 45651.16006596, 45630.4722909 ]
还有代码:
from scipy.fftpack import fft, fftfreq, fftshift
s = np.array(id1.u_motion)
Fs= 4
fig, axes = plt.subplots(nrows=3, ncols=2, figsize=(7, 7))
# plot time signal:
axes[0, 0].set_title("Signal")
axes[0, 0].plot(t, s, color='C0')
axes[0, 0].set_xlabel("Time")
axes[0, 0].set_ylabel("Amplitude")
# plot different spectrum types:
axes[1, 0].set_title("Magnitude Spectrum")
axes[1, 0].magnitude_spectrum(s, Fs=Fs, color='C1')
axes[1, 1].set_title("Log. Magnitude Spectrum")
axes[1, 1].magnitude_spectrum(s, Fs=Fs, scale='dB', color='C1')
axes[2, 0].set_title("Phase Spectrum ")
axes[2, 0].phase_spectrum(s, Fs=Fs, color='C2')
axes[2, 1].set_title("Angle Spectrum")
axes[2, 1].angle_spectrum(s, Fs=Fs, color='C2')
axes[0, 1].remove() # don't display empty ax
fig.tight_layout()
plt.show()
任何人都可以帮助找出为什么我在幅度规格中没有出现任何尖峰的原因吗? 非常感谢!
【问题讨论】:
-
如果信号中没有比其他所有信号更强的周期性分量,您的频谱中不会出现任何峰值。
-
但是蓝色图中不是有周期信号吗?
-
我不知道,可能是随机的。
-
删除数据的 DC 部分,只需从每个点减去数据向量的平均值。
标签: python time-series signal-processing fft spectrogram