function brownian_2d_plot ( )

%*****************************************************************************80
%
%% BROWNIAN_2D_PLOT plots Brownian motion in 2D.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    19 July 2018
%
%  Author:
%
%    John Burkardt
%
  timestamp ( );
  fprintf ( 1, '\n' );
  fprintf ( 1, 'BROWNIAN_2D_PLOT:\n' );
  fprintf ( 1, '  Octave version\n' );
  fprintf ( 1, '  Plot Brownian motion in two dimensions.\n' );
%
%  Read data from file.
%
  filename = 'brownian_2d_data.txt';
  x = load ( filename );
  [ n, ~ ] = size ( x );
%
%  Display.
%
  clf
  hold on
  plot ( x(:,1), x(:,2), 'Color', 'b', 'LineWidth', 2 )
  plot ( x(1,1), x(1,2), 'g.', 'MarkerSize', 35 );
  plot ( x(n,1), x(n,2), 'r.', 'MarkerSize', 35 );
  grid on
  xlabel ( '<--X-->' )
  ylabel ( '<--Y-->' )
  title ( 'Brownian motion in two dimensions' )
  axis equal
  hold off

  pause ( 5 )
%
%  Save graphics to a file.
%
  filename = sprintf ( 'brownian_2d_plot.png' );
  print ( '-dpng', filename );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Plot saved as "%s".\n', filename );
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'BROWNIAN_2D_PLOT:\n' );
  fprintf ( 1, '  Normal end of execution.\n' );
  fprintf ( 1, '\n' );
  timestamp ( );

  return
end
function timestamp ( )

%*****************************************************************************80
%
%% TIMESTAMP prints the current YMDHMS date as a timestamp.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    14 February 2003
%
%  Author:
%
%    John Burkardt
%
  t = now;
  c = datevec ( t );
  s = datestr ( c, 0 );
  fprintf ( 1, '%s\n', s );

  return
end

