Jan 19, 2012

How to Make a Point in a Circle in MATLAB

,
MATLAB is a mathematical and statistical analysis package produced by software company MathWorks Inc. MATLAB contains a number of built-in numerical and graphical functions, and as it is essentially a programming language, it is highly customizable. If you need to draw a circle and mark a specific point in that circle, you can do so with complete accuracy using the coordinates system built into MATLAB.


Instructions

    • 1
      Launch MATLAB. Click File and select Open. Browse to the location of the project to which you wish to add the circle on your computer's hard drive, then double-click it to load it into MATLAB. If you want to perform this operation on a new project, click File and then select New instead of Open.
    • 2
      Click File and select New M-File. A new MATLAB editor window will appear.
    • 3
      Type the following into the first line of the editor window:
      pdecirc(xc,yc,radius,name)
      Replace “xc” and “yc” with the x- and y-coordinates of the center of the circle. Replace “radius” with the radius you want the circle to have. Then replace “name” with a descriptive label for the circle. For example, the following line would create a circle at the zero point in the coordinates, with a radius of 10 units and the label “circle1”:
      pdecirc(0,0,10,circle1)
    • 4
      Type the following line of code into the editing window, directly below the line you just typed:
      plot(x,y,'r.','MarkerSize',size)
      Replace “x” and “y” with the x- and y-coordinates at which you want to position your point. Then replace "size" with the size that you want the point to be.
    • 5
      Run the program by clicking the "Run" button, which looks like a green triangle. A circle with a point marked at the coordinates you specified will now be drawn.

0 commentaires to “How to Make a Point in a Circle in MATLAB”

Post a Comment

 

HowToYo Copyright © 2011 | Template design by O Pregador | Powered by Blogger Templates