Using Matlab to discreetly distribute points

  • Thread starter Thread starter mcooper
  • Start date Start date
  • Tags Tags
    Matlab Points
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
1 reply · 2K views
mcooper
Messages
28
Reaction score
0
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 don't have the vast library of code as yet.

Any help at all would be great.

Thanks!
 
Last edited:
Physics news on Phys.org
You can do this pretty easily in MATLAB:
http://www.mathworks.com/access/helpdesk/help/techdoc/learn_matlab/f3-27853.html

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: