• 大小: 4KB
    文件类型: .m
    金币: 1
    下载: 0 次
    发布日期: 2021-05-22
  • 语言: Matlab
  • 标签: CEEMD  MATLAB  

资源简介

这是CEEMD的MATLAB代码,经过上传者测试,该代码可用,与大家共享

资源截图

代码片段和文件信息

function [imftresidtspecwaddmeancountimfnresidn] = ceemdnew(xthrshsthreshNalpha)

x   = transpose(x(:));
imf = [];
k=0;
xt=x;
if nargin<5
%     alpha=.1*std(xt);
alpha=0.5*std(xt);% 按照需要修改,huang的建议是0.1,但是0.1会造成端点噪声大。
end
cx=0;
s=0;
i=1;
lim=1;
imfprev=[];
while i    if i~=1
        Noise=alpha.*randn(size(xt));
    else
        Noise=0;
    end
    for t=1:lim
        count=0;
        x=xt+(-1)^t*Noise;
        while ~ismonotonic(x)
            count=count+1;
            if i==1
                k=k+1;
                imf{count}=zeros(size(x));
                meancount(k)=0;
            end
           x1 = x;
           VA = Inf;
           cn=0;
           while (VA > thrsh) | ~isimf(x1)
               cn=cn+1;
              s1 = getspline(x1);
              s2 = -getspline(-x1);
              x2 = x1-(s1+s2)/2;
              VA = var((s1+s2)./(2*x1));
              x1 = x2;
              if i==1 cx=cx+1; elseif cn>cx*2 break; end
              if i==1 && cx>numel(xt)/2
                  s=s+1;
                  if s>sthresh
                      x1=xt+alpha.*randn(size(xt));
                      s=0;
                      cx=0;
                      disp(‘Restarting Sifting‘);
                  end
              end
           end
%            if cn>cx*2 && i~=1
%                disp(‘Too long for ensemble member breaking count‘)
%                flag=1;
%                break;
%            else
%                flag=0;
%            end
           
           if count<=k 
               if i==1 
                   imf{count} = x1+imf{count}; 
               else
                   imf{tcount}=x1+imf{tcount}; 
               end;
           else
               break;
           end
           x=x-x1;
        end
        
        if i==1
            resid=repmat(x21);
            imf=repmat(imf21); 
%         elseif flag==0
        else
            resi

评论

共有 条评论