% list_std.m
%  Set up 100 random values, compute average and standard deviation.
%
x = rand ( 1, 100);
disp ( 'First 5 and last 5 values:' );
x(1:5)
x(n-4:n)
y = sort ( x );
disp ( 'First 5 and last 5 values after sorting:' );
y(1:5)
y(n-4:n)
n = length ( y );
fprintf ( 'The vector has length %d\n', n );
yave = sum ( y ) / n;
fprintf ( 'The average value is %f\n', yave );
ystd = ...
  sqrt ( ...
         sum ( ...
               ( y - yave ) .^ 2 ...
             ) ...
         / n ...
       );
fprintf ( 'The standard deviation is %f\n', ystd );
