% walker_2d_max_averages displays average 2D random walk lengths.
%
fprintf ( 'Walks are taken in the SQUARE.\n' );
m = 1000;
fprintf ( 'Averages are based on %d trials.\n', m );

fprintf ( '\n' );
fprintf ( '   N    Average length\n' );
fprintf ( '\n' );

for n = 1 : 20
  average(n) = walker_2d_max_average ( n, m );
  fprintf ( '  %2d  %f\n', n, average(n) );
end
x = 1:20;

plot ( x, average, 'b.', x, x.^2, 'r-', 'LineWidth', 3, 'MarkerSize', 50 );
grid on
xlabel ( '<-- Walk Width -->' );
ylabel ( '<-- Average Steps -->' );
title ( 'Steps taken in random 2D SQUARE walks', 'Fontsize', 24 );
print ( '-djpeg', 'walker_2d_max_averages.jpg' );

