function xs = r8vec_standardize ( n, x )
%*****************************************************************************80
%
%% r8vec_standardize() standardizes 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
%
% Input:
%
% integer N, the number of entries in the vector.
%
% 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