function [e,wmcr]=algo_mcr(u,d,M,lambda);

    N=length(u);
	%initialisation
	wmcr=zeros(M,N);
	Kmcr=100*eye(M);
  
	u_v=zeros(M,1);
	
	for n=1:N
		u_v=[u(n);u_v(1:M-1)];
		e(n)=d(n)'-u_v'*wmcr(:,n);
		Kn=Kmcr/lambda;
		Kmcr=Kn-Kn*u_v*u_v'*Kn/(1+u_v'*Kn*u_v);
		wmcr(:,n+1)=wmcr(:,n)+Kmcr*u_v*e(n)';
    end
 