採用された回答

Matt J
Matt J 2021 年 3 月 14 日
編集済み: Matt J 2021 年 3 月 14 日

1 投票

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 件のコメント

Russel Burgess
Russel Burgess 2021 年 3 月 14 日
And if you want the distribution to be uniform across the area:
r=R*sqrt(rand(N,1));
SAILESH R
SAILESH R 2021 年 3 月 16 日
Thank You very much Sirs.. Was Really helpful to me. Kudos....

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange で Random Number Generation についてさらに検索

製品

リリース

R2020b

タグ

質問済み:

2021 年 3 月 14 日

コメント済み:

2021 年 3 月 16 日

Community Treasure Hunt

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

Start Hunting!

Translated by