function predator_test ( )

%*****************************************************************************80
%
%% predator_test calls ode45() with specific values of n, a, b, and y0.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    29 October 2020
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'predator_test:\n' );
  fprintf ( 1, '  Use ode45 to compute the solution of the predator/prey\n' );
  fprintf ( 1, '  differential equation.\n' );

  a = 0.0;
  b = 5.0;
  r = 5000;
  f = 100;
  y0 = [ r, f ];
  
  [ t, y ] = ode45 ( @(t,y)predator_deriv(t,y), [ a, b ], y0 );
%
%  Report number of steps.
%  N-1, because (T,Y) includes the initial condition data.
%
  n = length ( t );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  ode45() took %d integration steps\n', n - 1 );
%
%  Plot y(t) and y'(t).
%
  figure ( 1 )
  plot ( t, y, 'linewidth', 3 );
  grid ( 'on' );
  xlabel ( '<-- T -->' );
  ylabel ( '<-- Y(T) -->' );
  title ( 'ode45 predator solution' );
  filename = 'predator_plot.png';
  print ( '-dpng', filename );
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );
%
%  Plot y versus y1.
%
  figure ( 2 )
  plot ( y(:,1), y(:,2), 'linewidth', 3 );
  grid ( 'on' );
  xlabel ( '<-- Prey(T) -->' );
  ylabel ( '<-- Predators(T) -->' );
  title ( 'ode45 predator phase plot' );
  filename = 'predator_phase.png';
  print ( '-dpng', filename );
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );

  return
end

