function c = cosine_transform_data ( n, d )

%*****************************************************************************80
%
%% COSINE_TRANSFORM_DATA does a cosine transform on a vector of data.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    26 August 2015
%
%  Author:
%
%    John Burkardt
%
%  Parameters:
%
%    Input, integer N, the number of data points.
%
%    Input, real D(N), the vector of data.
%
%    Output, real C(N), the cosine transform coefficients.
%
  c = zeros ( n, 1 );

  for i = 1 : n
    for j = 1 : n
      c(i) = c(i) + cos ( pi * ( 2 * j - 1 ) * ( i - 1 ) / 2.0 / n ) * d(j);
    end
  end

  c(1:n) = c(1:n) * sqrt ( 2.0 / n );

  return
end
