How to distribute random points outwards from a center location?
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Walter Roberson
2022-9-30
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 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!