How to distribute random points outwards from a center location?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
MS
el 30 de Sept. de 2022
Respondida: Walter Roberson
el 30 de Sept. de 2022
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.
0 comentarios
Respuesta aceptada
Walter Roberson
el 30 de Sept. de 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.
0 comentarios
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!