VMD分解代码,用于一维信号的分解

VMD分解代码,用于一维信号的分解

VMD分解用于信号分解,分解出不同的组合。

VMD分解用于信号分解,分解出不同的组合。

#. Time Domain 0 to T 时域0到T
T = 200000
fs = 1/T
t = np.arange(1,T+1)/T
freqs = 2*np.pi*(t-0.5-fs)/(fs)

#. center frequencies of components 组件的中心频率

#. Time Domain 0 to T 时域0到T
T = 200000
fs = 1/T
t = np.arange(1,T+1)/T
freqs = 2*np.pi*(t-0.5-fs)/(fs)

#. center frequencies of components 组件的中心频率

f_1 = 2
f_2 = 24
f_3 = 288

#. modes 模式

v_1 = (np.cos(2*np.pi*f_1*t))
v_2 = 1/4*(np.cos(2*np.pi*f_2*t))
v_3 = 1/16*(np.cos(2*np.pi*f_3*t))

# f = v_1 + v_2 + v_3 + 0.1*np.random.randn(v_1.size)
f=np.loadtxt('C:\\Users\\Administrator\\Desktop\\数据文件\\20201008009.txt')
#. some sample parameters for VMD VMD 的一些示例参数

alpha = 2000       # moderate bandwidth constraint 适度的带宽限制
tau = 0.            # noise-tolerance (no strict fidelity enforcement) 噪声容限(没有严格的保真执行)
K = 6              # 3 modes 3种模式
DC = 0             # no DC part imposed 没有施加直流部分
init = 1           # initialize omegas uniformly 统一初始化 omegas
tol = 1e-7


#. Run VMD 运行 VMD
u, u_hat, omega = VMD(f, alpha, tau, K, DC, init, tol)

#. Visualize decomposed modes  可视化分解的模式
plt.figure(1)
plt.subplot()
plt.plot(f)
plt.title('Original signal')
plt.xlabel('time (s)')
plt.figure(2)
plt.subplot()
plt.plot(u.T)
plt.title('Decomposed modes')
plt.xlabel('time (s)')
plt.legend(['Mode %d'%m_i for m_i in range(u.shape[0])])
plt.tight_layout()
plt.show()

 

 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值