小波变换01(小波降噪)
2020年8月19日 18:48浏览:3371 评论:12
摘要:本文用一个实例演示小包变换的信号降噪功能。本文素材来自网络,笔者作了稍微整理。
01小波变换
小波变换和傅里叶变换都属于积分变换,马拉算法在小波变换中的地位类似FFT算法在傅里叶变换中的地位。
02小波降噪实例
python小波扩展库pywavelets中有几个demo signals

引入心电信号:
import matplotlib.pyplot as plt
import pywt
ecg = pywt.data.ecg() # 生成心电信号
plt.plot(ecg)
plt.show()

coeffs = pywt.wavedec(ecg,'db8') # 对信号进行多层小波分解

threshold = 0.2
for i in range(1, len(coeffs)):
coeffs[i] = pywt.threshold(coeffs[i], threshold*max(coeffs[i])) # 降噪
ecgrec = pywt.waverec(coeffs,'db8') # 将信号进行小波重构
plt.subplot(2, 1, 1)
plt.plot(ecg)
plt.subplot(2, 1, 2)
plt.plot(ecgrec)
plt.show()

关于pywt.threshold()的用法:

技术邻APP
工程师必备
工程师必备
- 项目客服
- 培训客服
- 平台客服
TOP
11
12




















