function cheb_plot_test ( )

%*****************************************************************************80
%
%% cheb_plot_test() tests cheb().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    11 April 2020
%
%  Author:
%
%    Lloyd Trefethen.
%    Modification by John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'cheb_plot_test():\n' );
  fprintf ( 1, '  cheb() carries out Chebyshev differentiation.\n' );
  fprintf ( 1, '  Here, demonstrate differentation of a smooth function.\n' );

  xx = -1 : 0.01 : 1;
  uu = exp ( xx ) .* sin ( 5.0 * xx );
  clf ( );

  for N = [ 10, 20 ]

    [ D, x ] = cheb ( N ); 
    u = exp ( x ) .* sin ( 5.0 * x );
    subplot ( 'position', [.15 .66-.4*(N==20) .31 .28] )
    plot ( x, u, '.', 'markersize', 14 )
    grid ( 'on' )
    line ( xx, uu )
    title ( [ 'u(x),  N=' int2str(N) ] )
    error = D * u - exp(x) .* ( sin ( 5.0 * x) + 5.0 * cos ( 5.0 * x ) );
    subplot ( 'position', [.55 .66-.4*(N==20) .31 .28] )
    plot ( x, error, '.', 'markersize',14)
    grid ( 'on' )
    line ( x, error )
    title ( ['  error in u''(x),  N=' int2str(N) ] )

  end

  filename = 'cheb_plot_test.png';
  print ( '-dpng', filename );
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );


  return
end

