python 绘制 频谱图
效果图t = np.arange(0,time,1.0/sampling_rate)wavename = 'morl'# "cmorB-C" where B is the bandwidth and C is the center frequency.totalscal = 64# scalefc = pywt.central_frequency(wavename) #central freque
·
效果图
t = np.arange(0,time,1.0/sampling_rate)
wavename = 'morl' # "cmorB-C" where B is the bandwidth and C is the center frequency.
totalscal = 64 # scale
fc = pywt.central_frequency(wavename) # central frequency
cparam = 2 * fc * totalscal
scales = cparam/np.arange(1,totalscal+1)
[cwtmatr_l, frequencies_l] = pywt.cwt(data,scales,wavename,1.0/sampling_rate) # continuous wavelet transform
plt.figure(figsize=(8, 4))
plt.contourf(t, frequencies_l, abs(cwtmatr_l),cmap='jet', levels=np.linspace(0,50,100),extend='both')
plt.ylabel(u"freq(Hz)")
plt.xlabel(u"time(s)")
plt.colorbar()
其中,data是一个通道的信号数据,sample_rate是采样率,需要导入pywt包。
开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!
更多推荐
已为社区贡献3条内容
所有评论(0)