function heartbeat_ode45 ( )

%*****************************************************************************80
%
%% heartbeat_ode45() uses ode45() to solve heartbeat_ode().
%
%  Licensing:
%
%    This code is distributed under the MIT license. 
%
%  Modified:
%
%    21 March 2022
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'heartbeat_ode45():\n' )
  fprintf ( 1, '  Use ode45() to solve heartbeat_ode().\n' );

  [ a, epsilon, gamma, t0, y0, tstop ] = heartbeat_parameters ( );

  f = @ heartbeat_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 T, Y1.
%
  clf ( );
  plot ( t, y(:,1), 'r-', 'linewidth', 3 );
  grid ( 'on' );
  xlabel ( '<-- t -->' );
  ylabel ( '<-- y1(t) -->' );
  title ( 'heartbeat\_ode(): ode45: y1' );
  filename = 'heartbeat_ode45_y1.png';
  print ( '-dpng', filename );
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );
%
%  Plot T, Y2.
%
  clf ( );
  plot ( t, y(:,2), 'b-', 'linewidth', 3 );
  grid ( 'on' );
  xlabel ( '<-- t -->' );
  ylabel ( '<-- y2(t) -->' );
  title ( 'heartbeat\_ode(): ode45: y2' );
  filename = 'heartbeat_ode45_y2.png';
  print ( '-dpng', filename );
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );
%
%  Plot Y1, Y2.
%
  clf ( );
  plot ( y(:,1), y(:,2), 'c-', 'linewidth', 3 );
  grid ( 'on' );
  xlabel ( '<-- y1(t) -->' );
  ylabel ( '<-- y2(t) -->' );
  title ( 'heartbeat\_ode(): ode45: phase' );
  filename = 'heartbeat_ode45_phase.png';
  print ( '-dpng', filename );
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );

  return
end

