function regular_polygon ( n )

  if ( n < 3 )
    error ( 'N must be at least 3!' );
  end
%
%  Draw the circle.
%
  a = linspace ( 0.0, 2.0 * pi, 201 );
  xlist = cos ( a );
  ylist = sin ( a );
  plot ( xlist, ylist, 'k-' );
%
%  More graphics to come.
%
  hold on
%
%  Get N equally spaced angles.
%
  a = linspace ( 0.0, 2.0 * pi, n + 1 );
%
%  Add a random spin.
%
  a = a + 2.0 * pi * rand ( );

  xlist = cos ( a );
  ylist = sin ( a );
%
%  Fill the polygon.
%
  color = [ rand(), rand(), rand() ];
  fill ( xlist, ylist, color );
%
%  Draw the outline of the polygon in red.
%
  plot ( xlist, ylist, 'r.-', 'MarkerSize', 25, 'LineWidth', 3 );
%
%  Equal X/Y scale please.
%
  axis equal
%
%  Don't show x and y axis.
%
  axis off
%
%  Done graphics.
%
  hold off
%
%  Save a copy.
%
  print ( '-djpeg', 'regular_polygon.jpg' );

  return
end