function svd_vectors_test ( )

%*****************************************************************************80
%
%% SVD_VECTORS_TEST tests SVD_VECTORS.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    07 December 2018
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'SVD_VECTORS_TEST:\n' );
  fprintf ( 1, '  SVD_VECTORS computes SVD vectors.\n' );
  fprintf ( 1, '  Data is a set of power vectors.\n' );
  fprintf ( 1, '  Do SVD analysis.\n' );
  fprintf ( 1, '  Display the SVD vectors.\n' );
%
%  Get the data array.
%
  xmin = -1.0;
  xmax = +1.0;
  m = 51;
  n = 8;

  x = linspace ( xmin, xmax, m );
  data = powers_data ( xmin, xmax, m, n );
%
%  Compute N SVD vectors.
%
  [ svd_vec, svd_val, avg ] = svd_vectors ( data, n );
%
%  Display the average and the SVD vectors.
%
  fig_num = 0;

  for j = 0 : n
    fig_num = fig_num + 1;
    figure ( fig_num );
    clf
    if ( j == 0 )
      plot ( x, avg, 'Linewidth', 3 );
      label = 'SVD average';
    else
      plot ( x, svd_vec(:,j), 'Linewidth', 3 );
      label = sprintf ( 'SVD vector #%d  SVD value = %g', j, svd_val(j) );
    end
    title ( label, 'Fontsize', 16 );
    ylim ( [ -1.0, +1.0] );
    grid ( 'on' );
    filename = sprintf ( 'svd_vectors_%d.png', j );
    print ( '-dpng', filename );
    fprintf ( 1, '  Graphic saved as "%s"\n', filename );
  end
%
%  Display the singular values.
%
  fig_num = fig_num + 1;
  figure ( fig_num );
  clf
  plot ( svd_val, 'ob-', 'Linewidth', 3 );
  title ( 'Singular values', 'Fontsize', 16 );
  grid ( 'on' );
  filename = 'svd_values.png';
  print ( '-dpng', filename );
  fprintf ( 1, '  Graphic saved as "%s"\n', filename );
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'SVD_VECTORS_TEST:\n' );
  fprintf ( 1, '  Normal end of execution.\n' );

  return
end
