function a = r8vec_sftf_matrix ( n )

%*****************************************************************************80
%
%% r8vec_sftf_matrix() returns the slow Fourier transform forward matrix.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    17 October 2015
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer N, the number of data values.
%
%  Output:
%
%    real A(1+2*(N/2),1+2*(N/2)), the Fourier coefficients.
%
  nh = floor ( n / 2 );
  nn = 1 + 2 * nh;

  a = zeros ( nn, nn );

  i = 1;
  a(i,1:n) = 1.0 / n;

  for k = 1 : nh

    for j = 1 : n
      theta = 2 * k * ( j - 1 ) * pi / n;
      i = 2 * k;
      if ( k < nh )
        a(i,j) = 2.0 * cos ( theta ) / n;
      else
        a(i,j) = cos ( theta ) / n;
      end
      i = 2 * k + 1;
      if ( k < nh )
        a(i,j) = 2.0 * sin ( theta ) / n;
      else
        a(i,j) = sin ( theta ) / n;
      end
    end

  end

  return
end
