经验模态分解python_信号处理 - 经验模态分解 【1】

EMD,经验模态分解,是一种信号分解的技术;

它提出了一个概念叫 基本模态分量 IMF,

EMD 用于处理非平稳信号,可用于任意数据,基于数据本身进行分解;

EMD 把一个信号分解成 多个 IMF,每个 IMF 具有线性和非线性的特点,还有一个 信号残余分量,常常代表信号的直流分量或者信号的趋势;

EMD 分解得到的 IMF,频率逐渐降低,尺度各不相同;

EMD 分解得到的前几个模态分量,通常集中了原始信号中最显著、最重要的信息;

EMD 分解容易造成 模态混合,表现为下列现象之一:

1. 在同一个 IMF 中,尺度分布范围很宽却又各不相同的信号;

2. 在不同 IMF 中,存在尺度相近的信号;

模态混合使得 IMF 失去单一特征尺度,形成尺度混杂的震荡,失去原有的物理意义

EEMD,集合经验模态分解,解决了 EMD 模态混合的现象

使用方法

安装:pip install EMD-signal

Python EMD 用法

##### 基本用法

importnumpy as npfrom PyEMD importEMDimportpylab as plt

s= np.random.random(100)

emd=EMD()

IMFs=emd.emd(s)##### 示例#Define signal

t = np.linspace(0, 1, 200)

s= np.cos(11*2*np.pi*t*t) + 6*t*t#Execute EMD on signal

IMF =EMD().emd(s,t)

N= IMF.shape[0]+1

#Plot results

plt.subplot(N,1,1)

plt.plot(t, s,'r')

plt.title("Input signal: $S(t)=cos(22\pi t^2) + 6t^2$")

plt.xlabel("Time [s]")for n, imf inenumerate(IMF):

plt.subplot(N,1,n+2)

plt.plot(t, imf,'g')

plt.title("IMF"+str(n+1))

plt.xlabel("Time [s]")

plt.tight_layout()

plt.savefig('simple_example')

plt.show()

输出

Python EEMD 用法

def eemd(self, S, T=None, max_imf=-1)

S:一维信号

T:时间,相当于 x,如果没有 时间,就用 None

max_imf:分解成多少个 基本模态分量,注意 还有一个 残余分量,也就是 max_imf = 2 的话,有生成 3 个 imf

示例

from PyEMD importEEMDimportnumpy as npimportpylab as pltdefmain():#Define signal

t = np.linspace(0, 1, 200)

sin= lambda x,p: np.sin(2*np.pi*x*t+p)

S= 3*sin(18,0.2)*(t-0.2)**2S+= 5*sin(11,2.7)

S+= 3*sin(14,1.6)

S+= 1*np.sin(4*2*np.pi*(t-0.8)**2)

S+= t**2.1 -t#Assign EEMD to `eemd` variable

eemd =EEMD()#Say we want detect extrema using parabolic method

#emd = eemd.EMD

#emd.extrema_detection="parabol"

#eemd.trials = 50

#eemd.noise_seed(12345)

#Execute EEMD on S

eIMFs = eemd.eemd(S, t, -1)

nIMFs=eIMFs.shape[0]#Plot results

plt.figure(figsize=(12,9))

plt.subplot(nIMFs+1, 1, 1)

plt.plot(t, S,'r')for n inrange(nIMFs):

plt.subplot(nIMFs+1, 1, n+2)

plt.plot(t, eIMFs[n],'g')

plt.ylabel("eIMF %i" %(n+1))

plt.locator_params(axis='y', nbins=5)

plt.xlabel("Time [s]")

plt.tight_layout()

plt.savefig('eemd_example', dpi=120)

plt.show()if __name__ == '__main__':

main()

注意

1. 使用时 数据 是 浮点数;

2. eemd 必须 使用  if __name__ == '__main__' 运行,不知道为什么

总结

在实际应用中,EMD 可能与其他方法进行融合,比如 先进行 去燥,再 EMD 分解,或者 先 小波分解降噪,再 EMD 分解

参考资料:

《Adaboost_SVM集成模型的滚动轴承早期故障诊断》  电子书

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值