function [xx,yy] = circle( x0, y0, r, linestyle, n )
%CIRCLE      Draws a circle at given location with desired radius.
%   CIRCLE( X0, Y0, R, LINESTYLE, N ) draws a circle of radius R
%   centered at (X0,Y0) using the specified linestyle.  N is an
%   optional argument (default 128) used to control the number of
%   segments.
%   [XX,YY] = CIRCLE( ... ) suppresses the plot but returns values
%   such that PLOT(XX,YY) produces the desired circle.
%
%   See also PLOT.

%----------------------------------------------------------------------
%			  Copyright (C) 1995
%		Massachussetts Institute of Technology
%	       Sea Grant Underwater Vehicles Laboratory
%----------------------------------------------------------------------
%     $Revision: 1.1 $			$State: Exp $
%     $Author: bamoran $		$Date: 1995/04/03 04:09:42 $
%----------------------------------------------------------------------

if nargin < 5, n = 128; end;

phi = linspace( 0, 2*pi, n );

x = r*cos( phi );
y = r*sin( phi );

if nargout > 0
	xx = x;
	if nargout > 1, yy = y; end
else
	plot( x0 + x, y0 + y, linestyle );
end
