function brusselator_ode_test ( )

%*****************************************************************************80
%
%% brusselator_ode_test tests brusselator_ode().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    09 February 2020
%
%  Author:
%
%    John Burkardt
%
%  Reference:
%
%    John D Cook,
%    Behold! The Brusselator!,
%    https://www.johndcook.com/blog/
%    Posted 07 February 2020.
%
%    Rene Lefever, Gregoire Nicholis,
%    Chemical instabilities and sustained oscillations,
%    Journal of Theoretical Biology,
%    Volume 30, Issue 2, February 1971, Pages 267-284.
%
  addpath ( '../brusselator_ode' )

  timestamp ( );
  fprintf ( 1, '\n' );
  fprintf ( 1, 'brusselator_ode_test:\n' );
  fprintf ( 1, '  MATLAB/Octave version %s\n', version ( ) );
  fprintf ( 1, '  Test brusselator_ode using ode45.\n' );

  [ a, b, t0, xy0 ] = brusselator_parameters ( );

  figure ( );
  clf ( );
  hold ( 'on' )

  for x0 = 0 : 5
    for y0 = 0 : 3
      xy0 = [ x0; y0 ];
      tspan = [ t0, 10.0 ];
      [ t, xy ] = ode45 ( @brusselator_deriv, tspan, xy0 );

      plot ( xy(:,1), xy(:,2) );
    end
  end

  hold ( 'off' )
  grid ( 'on' );
  xlabel ( '<---  x(t)  --->' );
  ylabel ( '<---  y(t)  --->' );
  title ( 'Brusselator phase plot' )
  filename = 'brusselator_ode_phase.png';
  print ( '-dpng', filename );
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'brusselator_ode_test:\n' );
  fprintf ( 1, '  Normal end of execution.\n' );
  fprintf ( 1, '\n' );
  timestamp ( );

  rmpath ( '../brusselator_ode' )

  return
end
