1. Not finding help here? Sign up for a free 30min 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!

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.

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

    MATLABdude

    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:
    x=0:0.1:2*pi;
    y=sin(x);
    plot(x,y,'ko')

    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
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Using Matlab to discreetly distribute points
Loading...