www.gusucode.com > 局部均值分解源代码 难得的matlab程序代码源码 > lmd/test.m

    x=@(t) (2+cos(90*t).*cos(500*t+1800.*t.*t));
fs=5000;
t=0:1/fs:0.341;
y=x(t);
%subplot(5,1,1);plot(t,y);
[pf,a,si]=lmd1(y);

y=pf(2,:);
h=y;
chun_num=0;
%retry
chun_num=chun_num+1
t=1:length(h);
[envmin,envmax,envmoy,indmin,indmax,indzer] = envelope(t,h,'spline');
mi=(envmax+envmin)./2;
ai=abs(envmax-envmin)./2;
subplot(2,1,1);plot(t,y);hold on;
plot(t,ai,'r');
plot(t,mi,'g');
a=a.*ai;

si=(h-mi)./ai;
plot(t,si.*ai,'c');
subplot(2,1,2);plot(t,si);
h=si;

% c=y;
% k=0;
% wucha1=0.001;
% n_l=nengliang(y);
% %retry
% k=k+1;
%     a=1;
%     h=c;
% [pf,a,si]=zhaochun1(a,h,wucha1);
% subplot(5,1,2);plot(t,pf);
% subplot(5,1,3);plot(t,a);
% subplot(5,1,4);plot(t,si);