function predator_phase_euler ( n )

%*****************************************************************************80
%
%% predator_phase_euler shows a plot and phase plane for the predator problem.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    22 February 2020
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer N: the number of steps to take.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'predator_phase_euler' );
  fprintf ( 1, '  Solve predator-prey equation with Euler method\n' );
  fprintf ( 1, '  Plot solution and phase plane.\n' );

  if ( nargin < 1 )
    n = 100;
    fprintf ( 1, '\n' );
    fprintf ( 1, '  Input value N not supplied.  Using N = %d\n', n );
  end

  drfdt = @predator_deriv;
  tspan = [ 0.0, 250.0 ];
  rf0 = [ 4.0; 2.0 ];
  [ t, rf ] = euler ( drfdt, tspan, rf0, n );

  figure ( 1 )
  plot ( t, rf(:,1), 'g-', t, rf(:,2), 'r-', 'linewidth', 3 );
  grid ( 'on' ); 
  xlabel ( '<--T-->' );
  ylabel ( '<--R(T), F(T)-->' );
  title ( 'Predator Prey plot (Euler).' );
  legend ( 'Rabbits', 'Foxes' );
  filename = 'predator_plot.png';
  print ( '-dpng', filename );
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );

  figure ( 2 )
  plot ( rf(:,1), rf(:,2), 'linewidth', 3 );
  grid ( 'on' );
  xlabel ( '<-- R(T)-->' );
  ylabel ( '<-- F(T)-->' );
  title ( 'Predator Prey phase plane (Euler).' );
  filename = 'predator_phase.png';
  print ( '-dpng', filename );
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );

  return
end

