format long
x=100*ones(100,1)+1e-5*(rand(100,1)-0.5);
s=x(1);mu=s;sigma2=0;n=1;
while n<length(x),
  n=n+1;
  s=s+x(n);
  mu=s/n;
  sigma2=(n-1)*sigma2/n+(x(n)-mu)^2/(n-1);
end
means=[mu mean(x)]
variances=[sigma2 var(x,1)]
sigma=sqrt(sigma2);
standarddev=[sigma std(x,1)]
