小波函数绘制(Python)

摘要:import pywtimport matplotlib.pylab as pltplt.rcParams.update({"font.size": 12, "font.weight": 'bold', "lines.linewidth": 1.5})

import pywtimport matplotlib.pylab as pltplt.rcParams.update({"font.size": 12, "font.weight": 'bold', "lines.linewidth": 1.5})# Plot discrete Mayer wavelet Functionphi, psi, x = pywt.Wavelet('dmey').wavefun(level = 5)plt.figure(figsize=(4, 3), dpi=100, layout='constrained')plt.plot(x, psi, '-b', label = 'Wavelet')# plt.plot(x, phi, '-b', label = 'Scaling')plt.xlim([20, 40])#plt.legend(frameon = False, loc = 'upper right')# plt.title('Meyer Wavelet', fontsize=14, fontweight='bold')plt.xticks()plt.yticks()# plt.savefig('wav_dmey.png', dpi=400, bbox_inches='tight', pad_inches=0.02)plt.show# Coiflet waveletphi, psi, x = pywt.Wavelet('coif2').wavefun(level = 5)plt.figure(figsize=(4, 3), dpi=100, layout='constrained')plt.plot(x, psi, '-b', label = 'Wavelet')# plt.plot(x, phi, '-b', label = 'Scaling')#plt.text(0.005, 1.14, "(c)", fontdict = font)#plt.legend(frameon = False, loc = 'upper right')# plt.title('Coif3: Scaling Function', fontsize=14, fontweight='bold')plt.xlim([0, 10])plt.savefig('wav_coif2.png', dpi=400, bbox_inches='tight', pad_inches=0.02)plt.show# Daubechies waveletphi, psi, x = pywt.Wavelet('db2').wavefun(level = 5)plt.figure(figsize=(4, 3), dpi=100, layout='constrained')plt.plot(x, psi, '-b', label = 'Wavelet')# plt.plot(x, phi, '-b',label = 'Scaling')#plt.text(0.005, 1.14, "(c)", fontdict = font)#plt.legend(frameon = False, loc = 'upper right')# plt.title('Db6: Scaling Function', fontsize=14, fontweight='bold')plt.xlim([0, 3])plt.savefig('wav_db2.png', dpi=400, bbox_inches='tight', pad_inches=0.02)plt.show# Symlet waveletphi, psi, x = pywt.Wavelet('sym3').wavefun(level = 5)plt.figure(figsize=(4, 3), dpi=100, layout='constrained')plt.plot(x, psi, '-b', label = 'Wavelet')# plt.plot(x, phi, '-b', label = 'Scaling')#plt.text(0.005, 1.14, "(c)", fontdict = font)#plt.legend(frameon = False, loc = 'upper right')# plt.title('Symlet Wavelet', fontsize=14, fontweight='bold')plt.xlim([0, 5])plt.savefig('wav_sym3.png', dpi=400, bbox_inches='tight', pad_inches=0.02)plt.show# Biorthogonal wavelet_, psi, _, _, x = pywt.Wavelet('bior1.3').wavefun(level = 5)plt.figure(figsize=(4, 3), dpi=100, layout='constrained')plt.plot(x, psi, '-b', label = 'Wavelet')# plt.plot(x, phi, '-b', label = 'Scaling')#plt.text(0.005, 1.14, "(c)", fontdict = font)#plt.legend(frameon = False, loc = 'upper right')# plt.title('Symlet Wavelet', fontsize=14, fontweight='bold')plt.xlim([0, 5])plt.savefig('wav_bior1.3.png', dpi=400, bbox_inches='tight', pad_inches=0.02)plt.show# Reverse Biorthogonal wavelet_, psi, _, _, x = pywt.Wavelet('rbio1.3').wavefun(level = 5)plt.figure(figsize=(4, 3), dpi=100, layout='constrained')plt.plot(x, psi, '-b', label = 'Wavelet')# plt.plot(x, phi, '-b', label = 'Scaling')#plt.text(0.005, 1.14, "(c)", fontdict = font)#plt.legend(frameon = False, loc = 'upper right')# plt.title('Symlet Wavelet', fontsize=14, fontweight='bold')plt.xlim([0, 5])plt.savefig('wav_rbior1.3.png', dpi=400, bbox_inches='tight', pad_inches=0.02)plt.showphid, psid, xd = pywt.Wavelet('db6').wavefun(level = 5) # Daubechies waveletphic, psic, xc = pywt.Wavelet('coif3').wavefun(level = 5) # Coiflet waveletphis, psis, xs = pywt.Wavelet('sym10').wavefun(level = 5) # Symlet waveletphim, psim, xm = pywt.Wavelet('dmey').wavefun(level = 5) # Meyer waveletfig, ax = plt.subplots(2, 2)ax[0, 0].plot(xd, psid, '-b')ax[0, 1].plot(xc, psic, '-b')ax[1, 0].plot(xs, psis, '-b')ax[1, 1].plot(xm, psim, '-b')plt.show

知乎学术咨询:

https://www.zhihu.com/consult/people/792359672131756032?isMe=1

担任《Mechanical System and Signal Processing》《中国电机工程学报》等期刊审稿专家,擅长领域:信号滤波/降噪,机器学习/深度学习,时间序列预分析/预测,设备故障诊断/缺陷检测/异常检测。

分割线分割线

基于经验模态分解、离散小波变换和AR模型的肌电图信号降噪(Python,ipynb文件)

采用8种方法对一维信号进行降噪(Python)

NS: noisy signalS: original siganlmean filter: ws = window sizemedian filter:average filter: ns = number of noisy signal(different)bandpass filter: l = low cut-off frequency, h = high ...threshold filter: r = ratio(max abs(fft) / min ...)wavelet filter: a = thresholdstd filter:NN: neural network

基于整数小波变换的信号降噪方法(Python)

基于偏微分方程模型的信号降噪(MATLAB R2021B)

完整代码:

基于优化Morlet小波的一维信号瞬态特征提取方法(MATLAB )

程序运行环境为MATLAB R2018A,利用优化Morlet小波对一维信号进行瞬态特征提取。程序测试了模拟信号,地震信号,发动机销子活塞故障振动信号,发动机气门正常振动信号,发动机排气门故障振动信号,结果如下。

完整代码可通过知乎付费咨询获得(注意:每次付费咨询只能获得一套代码):

MATLAB环境下基于高分辨时频分析与阈值法的一维信号降噪

来源:凌阳教育

相关推荐