时序分解 | Matlab实现CEEMD互补集合经验模态分解时间序列信号分解
目录
- 时序分解 | Matlab实现CEEMD互补集合经验模态分解时间序列信号分解
- 效果一览
- 基本介绍
- 程序设计
- 参考资料
效果一览
基本介绍
Matlab实现CEEMD互补集合经验模态分解时间序列信号分解
1.分解效果图 ,效果如图所示,可完全满足您的需求~
2.直接替换txt数据即可用 适合新手小白 注释清晰~
3.附赠案例数据 直接运行main一键出图~
程序设计
- 完整源码和数据获取方式:Matlab实现CEEMD互补集合经验模态分解时间序列信号分解。
function allmode=ceemd(Y,Nstd,NE,TNM)
% find data length
xsize=length(Y);
dd=1:1:xsize;
% Nornaliz data
Ystd=std(Y);
Y=Y/Ystd;
% Initialize saved data
TNM2=TNM+2;
for kk=1:1:TNM2,
for ii=1:1:xsize,
allmode(ii,kk)=0.0;
end
end
for iii=1:1:NE
% adding noise
for i=1:xsize,
temp=randn(1,1)*Nstd;
X1(i)=Y(i)+temp;
X2(i)=Y(i)-temp;
end
% sifting X1
end
nmode = 1;
while nmode <= TNM,
xstart = xend;
iter = 1;
while iter<=5,
[spmax, spmin, flag]=extrema(xstart);
upper= spline(spmax(:,1),spmax(:,2),dd);
lower= spline(spmin(:,1),spmin(:,2),dd);
、
% save a mode
for jj=1:1:xsize,
mode(jj,nmode) = xstart(jj);
end
end
% save the trend
for jj=1:1:xsize,
mode(jj,nmode+1)=xend(jj);
end
% add mode to the sum of modes from earlier ensemble members
allmode=allmode+mode;
%%%=============================================================
end
nmode = 1;
while nmode <= TNM,
xstart = xend;
iter = 1;
while iter<=5,
[spmax, spmin, flag]=extrema(xstart);
upper= spline(spmax(:,1),spmax(:,2),dd);
lower= spline(spmin(:,1),spmin(:,2),dd);
mean_ul = (upper + lower)/2;
xstart = xstart - mean_ul;
iter = iter +1;
end
xend = xend - xstart;
nmode=nmode+1;
% save a mode
for jj=1:1:xsize,
mode(jj,nmode) = xstart(jj);
end
end
% save the trend
for jj=1:1:xsize,
mode(jj,nmode+1)=xend(jj);
end
% add mode to the sum of modes from earlier ensemble members
allmode=allmode+mode;
%fprintf('-');
end
% ensemble average
allmode=allmode/NE/2;
% Rescale mode to origional unit.
allmode=allmode*Ystd;