function pendulum_ode_test ( )

%*****************************************************************************80
%
%% pendulum_ode_test tests pendulum_ode.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    26 February 2019
%
%  Author:
%
%    John Burkardt
%
  addpath ( '../pendulum_ode' );

  timestamp ( );
  fprintf ( 1, '\n' );
  fprintf ( 1, 'pendulum_ode_test:\n' );
  fprintf ( 1, '  MATLAB version\n' );
  fprintf ( 1, '  Test pendulum_ode\n' );
  fprintf ( 1, '  Compare linear and nonlinear pendulum behavior.\n' );

  tspan = [ 0.0, 50.0 ];
  y0 = [ 70.0; 0.0 ];

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Initial angular deflection = %g degrees\n', y0(1) );
  fprintf ( 1, '  Initial angular velocity = %g degrees/second\n', y0(2) );

  y0 = y0 * pi / 180.0;

  [ tl, yl ] = ode23 ( @pendulum_linear, tspan, y0 );
  [ tn, yn ] = ode23 ( @pendulum_nonlinear, tspan, y0 );

  yl = yl * 180 / pi;
  yn = yn * 180 / pi;

  plot ( tl, yl(:,1), 'b-', tn, yn(:,1), 'r-', 'linewidth', 2 );
  grid ( 'on' );
  xlabel ( '<-- Time -->' );
  ylabel ( '<-- Angular deflection (degrees) -->' );
  title ( 'Compare deflection of linear and nonlinear pendulums.' );

  filename = 'pendulum_ode_test.png';
  print ( '-dpng', filename );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Graphics saved in "%s"\n', filename );
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'pendulum_ode_test:\n' );
  fprintf ( 1, '  Normal end of execution.\n' );
  fprintf ( 1, '\n' );
  timestamp ( );

  rmpath ( '../pendulum_ode' );

  return
end
