function logistic_euler_plot ( n )

%*****************************************************************************80
%
%% logistic_euler_plot plots the Euler approximation to the logistic ODE.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    07 September 2020
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    real N: the number of steps to take.
%
  if ( nargin < 1 )
    n = 10;
  end

  fprintf ( 1, '\n' );
  fprintf ( 1, 'logistic_euler_plot:\n' );
  fprintf ( 1, '  Plot the euler approximation to the logistic ODE\n' )
  fprintf ( 1, '  and compare to the exact solution.\n' );
%
%  Define the data.
%
  f = @ logistic_deriv;
  t0 = 0.0;
  tstop = 10.0;
  tspan = [ t0, tstop ];
  y0 = 0.2;
%
%  Get the Euler approximation.
%
  [ t1, y1 ] = euler ( f, tspan, y0, n );
%
%  Evaluate the exact solution.
%
  t2 = linspace ( t0, tstop, 101 );
  y2 = logistic_solution ( t2, t0, y0 );
%
%  Plot.
%
  plot ( t1, y1, 'ro', t2, y2, 'b', 'linewidth', 3 );
  grid ( 'on' );
  xlabel ( '<-- t -->' );
  ylabel ( '<-- y(t) -->' );
  s = sprintf ( '%d step Euler approximation to logistic equation', n );
  title ( s );
  legend ( 'Euler solution', 'Exact solution' );

  s = sprintf ( 'logistic_euler_%d.png', n );
  print ( '-dpng', s );

  return
end

