Using Matlab to discreetly distribute points

  • Thread starter Thread starter mcooper
  • Start date Start date
  • Tags Tags
    Matlab Points
Click For Summary
SUMMARY

This discussion focuses on efficiently distributing N points on the equation x² + y² = 2 using MATLAB. A user seeks assistance in creating a plot that visually represents these points. The suggested approach involves using MATLAB's plotting functions, specifically utilizing the syntax 'plot(x,y,'ko')' to display discrete black circles. Additionally, it is emphasized that since a circle does not represent a proper function, both branches of the circle must be plotted to accurately depict the relationship.

PREREQUISITES
  • Basic understanding of MATLAB syntax and functions
  • Familiarity with plotting in MATLAB
  • Knowledge of mathematical concepts related to circles and functions
  • Ability to manipulate arrays in MATLAB
NEXT STEPS
  • Explore MATLAB's plotting functions in detail
  • Learn about MATLAB's array manipulation techniques
  • Research how to plot parametric equations in MATLAB
  • Study the documentation on functions and their graphical representations in MATLAB
USEFUL FOR

This discussion is beneficial for novice MATLAB users, students learning mathematical plotting, and anyone interested in visualizing mathematical functions and their properties in MATLAB.

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:

Similar threads

  • · Replies 0 ·
Replies
0
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 10 ·
Replies
10
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 13 ·
Replies
13
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 0 ·
Replies
0
Views
736