Python - EEMD分解


# 導入工具包
import numpy as np
from PyEMD import EEMD, EMD, Visualisation
import pylab as plt

def Signal():
global E_imfNo
E_imfNo = np.zeros(50, dtype=np.int)

# EEMD options
max_imf = -1

"""
信號參數:
N:采樣頻率500Hz
tMin:采樣開始時間
tMax:采樣結束時間 2*np.pi
"""
N = 500
tMin, tMax = 0, 2 * np.pi
T = np.linspace(tMin, tMax, N)
# 信號S:是多個信號疊加信號
S = 3 * np.sin(4 * T) + 4 * np.cos(9 * T) + np.sin(8.11 * T + 1.2)

# EEMD計算
eemd = EEMD()
eemd.trials = 50
eemd.noise_seed(12345)

E_IMFs = eemd.eemd(S, T, max_imf)
imfNo = E_IMFs.shape[0]

# Plot results in a grid
c = np.floor(np.sqrt(imfNo + 1))
r = np.ceil((imfNo + 1) / c)
 plt.ioff()
plt.subplot(r, c, 1)
plt.plot(T, S, 'r')
plt.xlim((tMin, tMax))
plt.title("Original signal")

for num in range(imfNo):
plt.subplot(r, c, num + 2)
plt.plot(T, E_IMFs[num], 'g')
plt.xlim((tMin, tMax))
plt.title("Imf " + str(num + 1))

plt.show()
if __name__ == "__main__":
Signal()


轉自:https://www.cnblogs.com/RoseVorchid/p/12030980.html


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM