numPoints = 650;
width = 100;
x = 0;
y = 0;
figure('Position', [300 300 900 900])
rectangle('Position', [x, y, width, width],'LineWidth',2,'LineStyle','--');
grid on;
hold on;
xRandom = 50 + (width * rand(1, numPoints) - width / 2);
yRandom = 50 + (width * rand(1, numPoints) - width / 2);
plot(xRandom, yRandom, 'b.', 'MarkerSize', 8);
hold on;
plot(xRandom, yRandom, 'ro', 'MarkerSize', 20);
title(['',num2str(numPoints),' points inside one hectar'], 'Interpreter', 'None');
xlabel('length in meters');
ylabel('length in meters');
axis equal tight;
3 Comments
Direct link to this comment
https://fr.mathworks.com/matlabcentral/answers/453169-pseudo-random-distribution-of-points-with-minimum-distance#comment_687316
Direct link to this comment
https://fr.mathworks.com/matlabcentral/answers/453169-pseudo-random-distribution-of-points-with-minimum-distance#comment_687316
Direct link to this comment
https://fr.mathworks.com/matlabcentral/answers/453169-pseudo-random-distribution-of-points-with-minimum-distance#comment_687317
Direct link to this comment
https://fr.mathworks.com/matlabcentral/answers/453169-pseudo-random-distribution-of-points-with-minimum-distance#comment_687317
Direct link to this comment
https://fr.mathworks.com/matlabcentral/answers/453169-pseudo-random-distribution-of-points-with-minimum-distance#comment_687327
Direct link to this comment
https://fr.mathworks.com/matlabcentral/answers/453169-pseudo-random-distribution-of-points-with-minimum-distance#comment_687327
Sign in to comment.