Generate N random uniformly distributed points in the d-ball

5 ビュー (過去 30 日間)
christina
christina 2019 年 1 月 10 日
回答済み: Moreno, M. 2022 年 3 月 20 日
How to generate N random uniformly distributed points in the d - ball

回答 (2 件)

Bruno Luong
Bruno Luong 2019 年 1 月 10 日
編集済み: Bruno Luong 2019 年 1 月 10 日
d = 3
n = 10000;
% s is (d x n), n points in unit d-ball
s = randn(d,n);
r = rand(1,n).^(1/d);
c = r./sqrt(sum(s.^2,1));
s = bsxfun(@times, s, c);

Moreno, M.
Moreno, M. 2022 年 3 月 20 日
https://uk.mathworks.com/matlabcentral/fileexchange/108374-uniformly-distributed-points

カテゴリ

Help Center および File ExchangeRandom Number Generation についてさらに検索

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by