Home > atmlab > graphs > circle.m

circle

PURPOSE ^

CIRCLE Generate a circle

SYNOPSIS ^

function [x,y] = circle(x0,y0,r,n)

DESCRIPTION ^

 CIRCLE   Generate a circle

    To draw a circle:
       [x,y] = circle(1,1,1,30);
       line(x,y)

 FORMAT   [x,y] = circle(x0,y0,r,n)
        
 OUT   x   x coordinates
       y   y coordinates
 IN    x0  x coordinate for circle centre 
       y0  y coordinate for circle centre 
       r   circle radius
       n   number of brake points

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

circle.m

SOURCE CODE ^

0001 % CIRCLE   Generate a circle
0002 %
0003 %    To draw a circle:
0004 %       [x,y] = circle(1,1,1,30);
0005 %       line(x,y)
0006 %
0007 % FORMAT   [x,y] = circle(x0,y0,r,n)
0008 %
0009 % OUT   x   x coordinates
0010 %       y   y coordinates
0011 % IN    x0  x coordinate for circle centre
0012 %       y0  y coordinate for circle centre
0013 %       r   circle radius
0014 %       n   number of brake points
0015 
0016 % 2005-12-06   Created by Patrick Eriksson.
0017 
0018 
0019 function [x,y] = circle(x0,y0,r,n)
0020 
0021 alpha = linspace( 0, 2*pi, n );
0022 
0023 x = x0 + r * cos( alpha );
0024 y = y0 + r * sin( alpha );

Generated on Mon 15-Sep-2014 13:31:28 by m2html © 2005