function tough_ode23 ( )

%*****************************************************************************80
%
%% tough_ode23() tests tough_ode using ode23().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    30 November 2020
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'tough_ode23():\n' );
  fprintf ( 1, '  Test tough_ode using ode23.\n' );

  [ t0, y0, tstop ] = tough_parameters ( );

  f = @ tough_deriv;
  tspan = [ t0, tstop ];

  [ t, y ] = ode23 ( f, tspan, y0 );

  n = size ( t, 1 );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Number of variable steps = %d\n', n );

  te = linspace ( t0, tstop, 101 );
  ye = tough_exact ( te );
%
%  Plot y1.
%
  figure ( 1 );
  clf ( );
  plot ( t, y(:,1), 'ro', ...
         te, ye(:,1), 'b-', 'linewidth', 2 );
  grid ( 'on' );
  xlabel ( '<-- Time -->' );
  ylabel ( '<-- Y1(t) -->' );
  title ( 'tough ODE, ode23(): y1' );
  legend ( 'ode23', 'exact' );
  filename = 'tough_ode23_y1.png';
  print ( '-dpng', filename );
  fprintf ( 1, '  Graphics saved in "%s"\n', filename );
%
%  Plot y2.
%
  figure ( 2 );
  clf ( );
  plot ( t, y(:,2), 'ro', ...
         te, ye(:,2), 'b-', 'linewidth', 2 );
  grid ( 'on' );
  xlabel ( '<-- Time -->' );
  ylabel ( '<-- Y2(t) -->' );
  title ( 'tough ODE, y2: ode23' );
  legend ( 'ode23', 'exact' );
  filename = 'tough_ode23_y2.png';
  print ( '-dpng', filename );
  fprintf ( 1, '  Graphics saved in "%s"\n', filename );
%
%  Plot y3.
%
  figure ( 3 );
  clf ( );
  plot ( t, y(:,3), 'ro', ...
         te, ye(:,3), 'b-', 'linewidth', 2 );
  grid ( 'on' );
  xlabel ( '<-- Time -->' );
  ylabel ( '<-- Y3(t) -->' );
  title ( 'tough ODE, y3: ode23' );
  legend ( 'ode23', 'exact' );
  filename = 'tough_ode23_y3.png';
  print ( '-dpng', filename );
  fprintf ( 1, '  Graphics saved in "%s"\n', filename );
%
%  Plot y4.
%
  figure ( 4 );
  clf ( );
  plot ( t, y(:,4), 'ro', ...
         te, ye(:,4), 'b-', 'linewidth', 2 );
  grid ( 'on' );
  xlabel ( '<-- Time -->' );
  ylabel ( '<-- Y4(t) -->' );
  title ( 'tough ODE, y4: ode23' );
  legend ( 'ode23', 'exact' );
  filename = 'tough_ode23_y4.png';
  print ( '-dpng', filename );
  fprintf ( 1, '  Graphics saved in "%s"\n', filename );

  return
end

