function xs = r8vec_standardize ( n, x )

%*****************************************************************************80
%
%% R8VEC_STANDARDIZE standarizes an R8VEC.
%
%  Discussion:
%
%    The output vector will have 0 mean and unit standard deviation.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    10 October 2018
%
%  Author:
%
%    John Burkardt
%
%  Parameters:
%
%    Input, integer N, the number of entries in the vector.
%
%    Input, real X(N), the vector to be standardized.
%
%    Output, real XS(N), the standardized vector.
%
  mu = mean ( x );
  sigma = std ( x );

  xs = x;

  if ( sigma ~= 0.0 )
    xs = ( xs - mu ) / sigma;
  else
    xs = 0.0;
  end

  return
end

