Using Matlab to discreetly distribute points

  • Thread starter Thread starter mcooper
  • Start date Start date
  • Tags Tags
    Matlab Points
AI Thread Summary
To discreetly distribute N points on the circle defined by x² + y² = 2 using MATLAB, users can utilize the plotting functions available in the software. A suggested approach involves generating x values and calculating corresponding y values for both branches of the circle. The example provided demonstrates how to plot discrete points using black circles instead of a continuous graph. It's important to remember that a circle does not represent a proper function due to multiple y values for each x value. For further details, users are encouraged to consult MATLAB's documentation on plotting functions.
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:
Thread 'Have I solved this structural engineering equation correctly?'
Hi all, I have a structural engineering book from 1979. I am trying to follow it as best as I can. I have come to a formula that calculates the rotations in radians at the rigid joint that requires an iterative procedure. This equation comes in the form of: $$ x_i = \frac {Q_ih_i + Q_{i+1}h_{i+1}}{4K} + \frac {C}{K}x_{i-1} + \frac {C}{K}x_{i+1} $$ Where: ## Q ## is the horizontal storey shear ## h ## is the storey height ## K = (6G_i + C_i + C_{i+1}) ## ## G = \frac {I_g}{h} ## ## C...

Similar threads

Replies
0
Views
1K
Replies
1
Views
2K
Replies
10
Views
2K
Replies
1
Views
1K
Replies
3
Views
1K
Replies
1
Views
2K
Replies
2
Views
1K
Back
Top