image thumbnail
[x,y]=circle(no_pts,x0,y0,radius)
function [x,y]=circle(no_pts,x0,y0,radius)
%
% [x,y]=circle(no_pts,x0,y0,radius)
% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
% This function constructs the (x,y) 
% coordinates necessary to draw a circle.
%
% no_pts - number of points to construct
%          circle with
% x0,y0  - center coordinate of circle
% radius - radius of circle
%
% Notes:
%   A typical use of this function is:
%          [x,y]=circle(50,2,3,6);
%          plot(x,y);
%          axis('equal');
%   The axis command causes the aspect ratio of 
%   the circle to be correct.
%
% User m functions called:  none.
%----------------------------------------------

theta=linspace(0,2*pi,no_pts+1);
x=radius*cos(theta); x=x+x0;
y=radius*sin(theta); y=y+y0;

Contact us at files@mathworks.com