Inside a circle with random mesh points

 Risposta accettata

Matt J
Matt J il 14 Mar 2021
Modificato: Matt J il 14 Mar 2021
One way,
N=3e3; %number of points
R=3; %radius
r=R*rand(N,1);
theta=2*pi*rand(N,1);
X=r.*cos(theta); Y=r.*sin(theta);
scatter(X,Y); axis equal

2 Commenti

And if you want the distribution to be uniform across the area:
r=R*sqrt(rand(N,1));
Thank You very much Sirs.. Was Really helpful to me. Kudos....

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Random Number Generation in Centro assistenza e File Exchange

Prodotti

Release

R2020b

Tag

Richiesto:

il 14 Mar 2021

Commentato:

il 16 Mar 2021

Community Treasure Hunt

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

Start Hunting!

Translated by