You can use nested loops to plot a circle in MATLAB. One way to do this is by evaluating the equation of a circle at discrete points along its circumference, and then plotting those points. The equation of a circle is:
main.m30 chars2 lines
where (xc, yc) are the coordinates of the circle's center, and r is its radius. To plot a circle with resolution n, you can sample angles from 0 to 2pi, and compute the corresponding x and y coordinates using the above equation:
main.m104 chars6 lines
Then you can plot the points using the "plot" command:
main.m12 chars2 lines
Here's the complete code:
main.m227 chars13 lines
This will plot a circle centered at (0,0) with radius 1 and resolution 100.
gistlibby LogSnag