Python - EMD分解
郑重声明:本文档只是方便自己学习记录
1.EMD 工具包安装
下载地址:https://github.com/laszukdawid/PyEMD
2.解压工具包,将文件复制到自己的python(Anaconda)的Lib的site-packages
3.cmd切换到包的目录
4.输入python setup.py install安装
5.EMD分解实验
# 导入工具库
import numpy as np
from PyEMD import EMD, Visualisation
# 构建信号
t = np.arange(0,1, 0.01)
S = 2*np.sin(2*np.pi*15*t) +4*np.sin(2*np.pi*10*t)*np.sin(2*np.pi*t*0.1)+np.sin(2*np.pi*5*t)
# 提取imfs和剩余信号res
emd = EMD()
emd.emd(S)
imfs, res = emd.get_imfs_and_residue()
# 绘制 IMF
vis = Visualisation()
vis.plot_imfs(imfs=imfs, residue=res, t=t, include_residue=True)
# 绘制并显示所有提供的IMF的瞬时频率
vis.plot_instant_freq(t, imfs=imfs)
vis.show()