function c = correlation_sine_damped ( n, rho, rho0 )

%*****************************************************************************80
%
%% correlation_sine_damped() evaluates the damped sine correlation function.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    15 February 2012
%
%  Author:
%
%    John Burkardt
%
%  Reference:
%
%    Petter Abrahamsen,
%    A Review of Gaussian Random Fields and Correlation Functions,
%    Norwegian Computing Center, 1997.
%
%  Input:
%
%    integer N, the number of arguments.
%
%    real RHO(N), the arguments.
%
%    real RHO0, the correlation length.
%
%  Output:
%
%    real C(N), the correlations.
%
  c = ones ( size ( rho ) );

  rhohat = rho / rho0;
  i = find ( rhohat ~= 0 );
  c(i) = sin ( rhohat(i) ) ./ rhohat(i);

  return
end

