lwwhlkk 发表于 2008-12-17 19:11

求助emd分解出错

对信号Z进行EMD分解 imf=emd(z); 可是一运行,就出现以下的错误
我是从网上下载的HHT工具箱,还请好心人指点一二
??? Undefined command/function 'extr'.

Error in ==> emd at 148
= extr(m);

laoda 发表于 2008-12-17 19:19

缺少函数:extr

lwwhlkk 发表于 2008-12-17 19:53

回复 沙发 laoda 的帖子

我知道缺少这个函数,可是应该在那里能够找的到呢

00yangmin 发表于 2008-12-17 22:50

function = extr(x,t)

if(nargin==1)
t=1:length(x);
end

m = length(x);

if nargout > 2
x1=x(1:m-1);
x2=x(2:m);
indzer = find(x1.*x2<0);

if any(x == 0)
    iz = find( x==0 );
    indz = [];
    if any(diff(iz)==1)
      zer = x == 0;
      dz = diff();
      debz = find(dz == 1);
      finz = find(dz == -1)-1;
      indz = round((debz+finz)/2);
    else
      indz = iz;
    end
    indzer = sort();
end
end

d = diff(x);

n = length(d);
d1 = d(1:n-1);
d2 = d(2:n);
indmin = find(d1.*d2<0 & d1<0)+1;
indmax = find(d1.*d2<0 & d1>0)+1;


% when two or more successive points have the same value we consider only one extremum in the middle of the constant area
% (only works if the signal is uniformly sampled)

if any(d==0)

imax = [];
imin = [];

bad = (d==0);
dd = diff();
debs = find(dd == 1);
fins = find(dd == -1);
if debs(1) == 1
    if length(debs) > 1
      debs = debs(2:end);
      fins = fins(2:end);
    else
      debs = [];
      fins = [];
    end
end
if length(debs) > 0
    if fins(end) == m
      if length(debs) > 1
      debs = debs(1:(end-1));
      fins = fins(1:(end-1));

      else
      debs = [];
      fins = [];
      end
    end
end
lc = length(debs);
if lc > 0
    for k = 1:lc
      if d(debs(k)-1) > 0
      if d(fins(k)) < 0
          imax = ;
      end
      else
      if d(fins(k)) > 0
          imin = ;
      end
      end
    end
end

if length(imax) > 0
    indmax = sort();
end

if length(imin) > 0
    indmin = sort();
end

end
end
这个就是

lwwhlkk 发表于 2008-12-19 15:45

多谢多谢:lol
页: [1]
查看完整版本: 求助emd分解出错