function robertson_ode45 ( )

%*****************************************************************************80
%
%% robertson_ode45() uses ode45() to solve robertson_ode().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    25 April 2021
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'robertson_ode45():\n' );
  fprintf ( 1, '  Use ode45() to solve robertson_ode().\n' );

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

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

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

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

  figure ( 1 );
  clf ( );
  hold ( 'on' );
  plot ( t, y(:,1), 'linewidth', 3 );
  plot ( t, y(:,2), 'linewidth', 3 );
  plot ( t, y(:,3), 'linewidth', 3 );
  hold ( 'off' );
  grid ( 'on' );
  xlabel ( '<---  t  --->' );
  ylabel ( '<---  y(t)  --->' );
  title ( 'robertson_ode(): ode45(): plot' );
  legend ( 'y1', 'y2', 'y3' );
  filename = 'robertson_ode45_plot.png';
  print ( '-dpng', filename );
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );

  h = robertson_conserved ( t, y );

  figure ( 2 );
  hold ( 'on' );
    plot ( t, h, 'r-', 'linewidth', 3 );
    plot ( tspan, [h(1),h(1)], 'b--', 'linewidth', 3 );
    plot ( tspan, [0.0,0.0], 'k--', 'linewidth', 3 );
  hold ( 'off' );
  grid ( 'on' );
  xlabel ( '<---  t  --->' );
  ylabel ( '<---  y1+y2+y3  --->' );
  title ( 'robertson_ode(): ode45(): conservation' );
  filename = 'robertson_ode45_conservation.png';
  print ( '-dpng', filename );
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );

  return
end

