这里用了小波分析的函数
fA_range = np.linspace(0,50,11)
wavename = 'cgau6'
fc = pywt.central_frequency(wavename)
sampling_rate = 250e3
totalscal = sampling_rate/100
cparam = 2 * fc * totalscal
scales = cparam / np.arange(totalscal, 1, -1)
[cwtmatr, frequencies] = pywt.cwt(sxr, scales, wavename, 1 / sampling_rate)
fig = plt.figure()
ax1 = plt.subplot(2,1,1)
ax1.plot(time, sxr)
plt.xlabel(u"time(s)")
ax2 = plt.subplot(2,1,2, sharex=ax1)
contourf_ = ax2.contourf(time, frequencies, abs(cwtmatr),fA_range *0.01)
cbar = fig.colorbar(contourf_)
plt.ylabel(u"freq(Hz)")
plt.ylim((0, 500))
plt.xlabel(u"time(s)")
plt.subplots_adjust(hspace=0.4)
plt.show()
print("exit")
小波分析中得到了一个频率约为150Hz的频率,但是实际上的锯齿周期频率为300Hz左右
不知道是代码写错了,还是小波识别的其实是两个峰值的频率。
这个后面准备通过自行设置一个三角波去check
本文章使用limfx的vscode插件快速发布