function R=AutoCorr(x)
%
% AutoCorr Autocorrelation function 1-D
%
% Example R(d)=AutoCorr(x);
%

M=length(x);
R=zeros(M,1);
for d=0:M-1
   for i=0:M-1-d
      R(d+1)=R(d+1)+x(i+1)*x(i+1+d);
   end;	  
   R(d+1)=R(d+1)/(M-d);
end;
