function sir_ode45 ( )

%*****************************************************************************80
%
%% sir_ode45 solves sir_ode() using ode45().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    26 April 2021
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'sir_ode45():\n' );
  fprintf ( 1, '  Use ode45() to solve sir_ode().\n' );

  [ alpha, beta, gamma, t0, y0, tstop ] = sir_parameters ( );
%
%  Compute the approximate solution.
%
  f = @ sir_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 );
%
%  Plot S(t), I(t), R(t).
%
  figure ( 1 );
  clf ( );
  hold ( 'on' );
  plot ( t, y(:,1), 'g', 'LineWidth', 3 );
  plot ( t, y(:,2), 'r', 'LineWidth', 3 );
  plot ( t, y(:,3), 'b', 'LineWidth', 3 );
  hold ( 'off' );
  grid ( 'on' );
  xlabel ( '<-- Time -->' );
  ylabel ( '<-- Cases -->' );
  legend ( 'Susceptible', 'Infected', 'Recovered' );
  s = sprintf ( 'sir_ode(): ode45: \\alpha = %g, \\beta = %g, \\gamma = %g\n', ...
    alpha, beta, gamma );
  title ( s, 'Fontsize', 16 );
  filename = 'sir_ode45.png';
  print ( '-dpng', filename );
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );
%
%  Plot N(t) = S(t) + I(t) + R(t).
%
  h = sir_conserved ( y );

  figure ( 2 );
  clf ( );
  hold ( 'on' );
    plot ( t, h, 'c-', 'LineWidth', 3 );
    plot ( [ t0, tstop ], [ h(1), h(1) ], 'b--', 'LineWidth', 3 );
    plot ( [ t0, tstop ], [ 0.0, 0.0 ], 'k-', 'LineWidth', 3 );
  hold ( 'off' );
  grid ( 'on' );
  xlabel ( '<-- Time -->' );
  ylabel ( '<-- N(t) -->' );
  s = sprintf ( 'sir_ode(): ode45: N(t) \\alpha = %g, \\beta = %g, \\gamma = %g\n', ...
    alpha, beta, gamma );
  title ( s, 'Fontsize', 16 );
  filename = 'sir_ode45_conservation.png';
  print ( '-dpng', filename );
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );

  return
end
