石头王石头 发表于 2012-9-12 10:40

eemd的工具包怎么不能用

我在台湾中央大学数据分析中心下的eemd工具包怎么不能用,大家有没有eemd的源程序,分享一下,谢谢了

glise 发表于 2012-9-12 19:26

看看这个能不能用

石头王石头 发表于 2012-9-13 09:30

还是不行呀,clear;clc;
close all;
t=1:1000;
t1=t/100*2*pi;
a1=sin(t1);
t2=t/10*2*pi;
b1=linspace(0,0,1000);
for i=250:350
    b1(i)=0.2*sin(t2(i));
end
for i=750:850
    b1(i)=0.2*sin(t2(i));
end
x=a1+b1;%x是原信号
subplot(311);plot(t,a1);
subplot(312);plot(t,b1);
subplot(313);plot(t,x);
plot(x)
imf=emd(x);
emd_visu(x,t,imf)
%eemd
imf_eemd=eemd(x,0.1,100);
figure
subplot(511);plot(imf_eemd(:,1))
subplot(512);plot(imf_eemd(:,2))
subplot(513);plot(imf_eemd(:,3))
subplot(514);plot(imf_eemd(:,4))
subplot(515);plot(imf_eemd(:,5))
figure
subplot(511);plot(imf_eemd(:,6))
subplot(512);plot(imf_eemd(:,7))
subplot(513);plot(imf_eemd(:,8))
subplot(514);plot(imf_eemd(:,9))
subplot(515);plot(imf_eemd(:,10))
运行结果
??? Attempt to execute SCRIPT eemd as a function:
C:\Documents and Settings\wyd\My Documents\MATLAB\eemd.m

Error in ==> eemd1 at 22
imf_eemd=eemd(x,0.1,100);

石头王石头 发表于 2012-9-13 09:33

运行有错误,可是图像能出来,还有就是plot(imf_eemd(:,1)),为什么是按列画图呀,emd都是按行画的

石头王石头 发表于 2012-9-14 16:17

我知道是怎么回事了,把eemd的工具包运行一下,就可以了,麻烦大家了

冷冰清 发表于 2012-12-6 20:13

学习了,谢谢分享!

fred110 发表于 2012-12-14 10:43

学习一下,谢谢分享,要是能有一个注释就好了

任孝儒 发表于 2012-12-24 15:45

我怎么看不到啊

yazhoulong 发表于 2012-12-24 21:49

不错,分享一下

nishoulong 发表于 2013-2-1 20:06

谢谢分享

还是算了吧 发表于 2013-8-13 11:02

谢谢分享

yueyaquan 发表于 2013-8-27 19:00

石头王石头 发表于 2012-9-14 16:17 static/image/common/back.gif
我知道是怎么回事了,把eemd的工具包运行一下,就可以了,麻烦大家了

工具包能不能共享下,还有要是处理20000长度的数据,效果好吗?麻烦楼主

石头王石头 发表于 2013-9-2 17:37

yueyaquan 发表于 2013-8-27 19:00 static/image/common/back.gif
工具包能不能共享下,还有要是处理20000长度的数据,效果好吗?麻烦楼主

%function allmode=eemd(Y,Nstd,NE)
%
% This is an EMD/EEMD program
%
% INPUT:
%       Y: Inputted data;1-d data only
%       Nstd: ratio of the standard deviation of the added noise and that of Y;
%       NE: Ensemble number for the EEMD
% OUTPUT:
%       A matrix of N*(m+1) matrix, where N is the length of the input
%       data Y, and m=fix(log2(N))-1. Column 1 is the original data, columns 2, 3, ...
%       m are the IMFs from high to low frequency, and comlumn (m+1) is the
%       residual (over all trend).
%
% NOTE:
%       It should be noted that when Nstd is set to zero and NE is set to 1, the
%       program degenerates to a EMD program.(for EMD Nstd=0,NE=1)
%       This code limited sift number=10 ,the stoppage criteria can't change.
%
% References:   
%Wu, Z., and N. E Huang (2008),
%Ensemble Empirical Mode Decomposition: a noise-assisted data analysis method.
%   Advances in Adaptive Data Analysis. Vol.1, No.1. 1-41.
%
% code writer: Zhaohua Wu.
% footnote:S.C.Su 2009/03/04
%
% There are three loops in this code coupled together.
%1.read data, find out standard deviation ,devide all data by std
%2.evaluate TNM as total IMF number--eq1.
%    TNM2=TNM+2,original data and residual included in TNM2
%    assign 0 to TNM2 matrix
%3.Do EEMD NE times-------------------------------------------------------------loop EEMD start
%   4.add noise
%   5.give initial values before sift
%   6.start to find an IMF------------------------------------------------IMF loop start
%   7.sift 10 times to get IMF--------------------------sift loopstartand end
%   8.after 10 times sift --we got IMF
%   9.subtract IMF from data ,and let the residual to find next IMF by loop
%   6.after having all the IMFs---------------------------------------------IMF loop end
%   9.after TNM IMFs ,the residual xend is over all trend
%3.Sum up NE decomposition result-------------------------------------------------loop EEMD end
% 10.Devide EEMD summation by NE,std be multiply back to data
%
% Association: no
% this function ususally used for doing 1-D EEMD with fixed
% stoppage criteria independently.
%
% Concerned function: extrema.m
%                     above mentioned m file must be put together

function allmode=eemd(Y,Nstd,NE)

%part1.read data, find out standard deviation ,devide all data by std
xsize=length(Y);
dd=1:1:xsize;
Ystd=std(Y);
Y=Y/Ystd;

%part2.evaluate TNM as total IMF number,ssign 0 to TNM2 matrix
TNM=fix(log2(xsize))-1;
TNM2=TNM+2;
for kk=1:1:TNM2,
    for ii=1:1:xsize,
      allmode(ii,kk)=0.0;
    end
end

%part3 Do EEMD-----EEMD loop start
for iii=1:1:NE,   %EEMD loop -NE times EMD sum together

    %part4 --Add noise to original data,we have X1
    for i=1:xsize,
      temp=randn(1,1)*Nstd;
      X1(i)=Y(i)+temp;
    end

    %part4 --assign original data in the first column
    for jj=1:1:xsize,
      mode(jj,1) = Y(jj);
    end

    %part5--give initial 0 to xorigin and xend
    xorigin = X1;
    xend = xorigin;

    %part6--start to find an IMF-----IMF loop start
    nmode = 1;
    while nmode <= TNM,
      xstart = xend; %last loop value assign to new iteration loop
                     %xstart -loop start data
      iter = 1;      %loop index initial value

      %part7--sift 10 times to get IMF---sift loopstart
      while iter<=10,
            =extrema(xstart);%call function extrema
            %the usage ofspline ,please see part11.
            upper= spline(spmax(:,1),spmax(:,2),dd); %upper spline bound of this sift
            lower= spline(spmin(:,1),spmin(:,2),dd); %lower spline bound of this sift
            mean_ul = (upper + lower)/2;%spline mean of upper and lower
            xstart = xstart - mean_ul;%extract spline mean from Xstart
            iter = iter +1;
      end
      %part7--sift 10 times to get IMF---sift loopend      

      %part8--subtract IMF from data ,then let the residual xend to start to find next IMF
         xend = xend - xstart;

                nmode=nmode+1;

      %part9--after sift 10 times,that xstart is this time IMF
      for jj=1:1:xsize,
            mode(jj,nmode) = xstart(jj);
      end

    end
    %part6--start to find an IMF-----IMF loop end

    %part 10--after gottenall(TNM) IMFs ,the residual xend is over all trend
    %                        put them in the last column
    for jj=1:1:xsize,
      mode(jj,nmode+1)=xend(jj);
    end
    %after part 10 ,original +TNM-IMF+overall trend---those are all in mode   
   allmode=allmode+mode;

end
%part3 Do EEMD-----EEMD loop end

%part10--devide EEMD summation by NE,std be multiply back to data
allmode=allmode/NE;
allmode=allmode*Ystd;

%part11--the syntax of the matlab function spline
%yy= spline(x,y,xx); this means
%x and y are matrixs of n1 points ,use n1 set (x,y) to form the cubic spline
%xx and yy are matrixs of n2 points,we want know the spline value yy(y-axis) in the xx (x-axis)position
%after the spline is formed by n1 points ,find coordinate value on the spline for --n2 position.


yazhoulong 发表于 2014-2-1 23:48

{:{39}:},你的程序很实用

hpsnow 发表于 2014-4-11 16:10

价格序列可以使用不?
页: [1] 2 3
查看完整版本: eemd的工具包怎么不能用