1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Using Matlab to discreetly distribute points

  1. Oct 13, 2009 #1
    I want to discreetly distribute N points on x2 + y2 = 2 using Matlab. What is the most efficient code to do this?

    I am a relative novice to Matlab so dont have the vast library of code as yet.

    Any help at all would be great.

    Last edited: Oct 13, 2009
  2. jcsd
  3. Oct 14, 2009 #2


    User Avatar
    Science Advisor

    You can do this pretty easily in MATLAB:
    http://www.mathworks.com/access/helpdesk/help/techdoc/learn_matlab/f3-27853.html [Broken]

    If you did something along the lines of the following:

    You'll have discrete black circles instead of a continuous sine graph (the above link shows you more about the basic plotting function in MATLAB along with the various parameters you can use).

    EDIT: Remember that a circle isn't a proper function; there are two y values for every x value. What you can do is plot both branches (two sets of x's and y's) with the same marker--see the documentation again for how to do this.
    Last edited by a moderator: May 4, 2017
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook