function C=imf_lp(s) 
y=s;
K=length(s);
C=[];

flag=1;

while (flag~=K-1)
     c=get_imf_comp(y);
     C=[C; c];
     y=y-c;
     %subplot(2,1,1)
     %plot(s)
     %hold on
     %plot(y,'r')
     %hold off
     %subplot(2,1,2)
     %plot(diff(y))
     %drawnow
     i=find(diff(y)<0);
     j=find(diff(y)>0);
     flag=max(length(i),length(j));
     %count=count+1
 end
 
 [N,M]=size(C);
 C(N+1,:)=y;
 N=N+1;
 k=rank(C);
 while (N ~= k)
    C=[C(1:k-1,:); sum(C(k:N,:))];
    k=rank(C);
    [N,M]=size(C);
 end