求助有关EMD程序运行
自己参考几个emd的程序编了一个,但是运行的时候好像是死机了,请帮忙找下原因谢谢!!!function imf = bzemd(y)
k = y(:)'; % copy of the input signal (as a row vector)
N = length(y);
imf = [];
while (1)
h1 = k; % at the beginning of the sifting process, h is the signal
SD = 1; % Standard deviation which will be used to stop the sifting process
while SD > 0.3
maxmin = [];
maxmin1 = [];
maxmin2 = [];
%%%找到极值点并用3次样条拟合
%对第1点的处理
j=1;
m=1;
s(1)=y(1);
h(1)=1;
j=j+1;
r(1)=y(1);
q(1)=1;
m=m+1;
for i=2:(length(y)-1);
if and(y(i-1)<y(i),y(i)>=y(i+1));
s(j)=y(i);
h(j)=i;
maxmin1 = ;
j=j+1;
end
if and(y(i-1)>y(i),y(i)<y(i+1));
r(m)=y(i);
q(m)=i;
maxmin2=;
m=m+1;
end
end
maxmin=;
%对最后一点的处理
s(j)=y(length(y));
h(j)=length(y);
r(m)=y(length(y));
q(m)=length(y);
if size(maxmin,2) < 2 % then it is the residue
break
end
w=1:length(y);
c1=spline(h,s,w);
c2=spline(q,r,w);
c=(c1+c2)/2;
prevh = h1; % copy of the previous value of h before modifying it
h1 = h1 - c; % s
% calculate standard deviation
eps = 0.0000001; % to avoid zero values
SD = sum ( ((prevh - h1).^2) ./ (prevh.^2 + eps) );
end
imf = ; % store the extracted IMF in the matrix imf
% if size(maxmin,2)<2, then h is the residue
% stop criterion of the algo.
if size(maxmin,2) < 2
break
end
k = k - h1; % substract the extracted IMF from the signal
end
%subplot(5,1,1)
figure(1)
hold on
plot(y)
%subplot(5,1,2)
plot(c1,'r')
%subplot(5,1,3)
plot(c2,'r')
%subplot(5,1,4)
plot(c,'k')
%subplot(5,1,5)
figure(2)
plot(t)
%save f:
[ 本帖最后由 xinyuxf 于 2007-7-25 15:13 编辑 ]
回复 #2 xiaojin831108 的帖子
求极值点是不是有问题,可以参考一下http://forum.vibunion.com/forum/thread-43158-1-5.html
页:
[1]