
function[w,y,e,J,w1]=aacomplexnlms(x,dn,mubar,M,c)
%function[w,y,e,J,w1]=aacomplexnlms(x,dn,mubar,M,c)
%x=input data to the filter;dn=desired signal;
%M=filter order;c=constant;mubar=step-size equivalent parameter;
%x and dn must be of the same length;J=learning curve;
N=length(x);
y=zeros(1,N);
w=zeros(1,M);%initialized filter coefficient vector;
for n=M:N
   x1=x(n:-1:n-M+1);%for each n vector x1 is of length
   %M with elements from x in reverse order;
   y(n)=conj(w)*x1';
   e(n)=dn(n)-y(n);
   w=w+(mubar/(c+conj(x1)*x1'))*conj(e(n))*x1;
   w1(n-M+1,:)=w(1,:);
end;
J=e.^2;
%the columns of the matrix w1 depict the history of the
%filter coefficients;

                   
                  