How to distribute random points outwards from a center location?

2 visualizzazioni (ultimi 30 giorni)
Hello, I am trying to find a way to distribute random points outwards from a center location, where the points become more dense as distance from the center increases? Basically the opposite of Gaussian where the points are more dense at the center and less dense at the edges.

Risposta accettata

Walter Roberson
Walter Roberson il 30 Set 2022
cx = 3; cy = 5; %as appropriate
R = 20;
N = 1000;
theta = rand(1, N) * (2 * pi);
rbase = rand(1,N) * R;
[X, Y] = pol2cart(theta, rbase.^(1/2));
X = X + cx;
Y = Y + cy;
scatter(X, Y); title('even distribute in circle')
[X, Y] = pol2cart(theta, rbase.^(1/3));
X = X + cx;
Y = Y + cy;
scatter(X, Y); title('distribute 1/3')
You can see that the second plot is distributed more densely as it gets further away from the center.

Più risposte (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by