function y=dof(x)
fop=crosscorr(x-mean(x),x-mean(x),fix(length(x)/2));
kk=0;
n=0;
y=1;
for i=1:length(x)/2
   if (kk==0) & (fop(fix(length(x)/2)+i)<exp(-1))
       y=fix(length(x)/i);
       kk=1;
   end
end
