Generate N random uniformly distributed points in the d-ball

8 Ansichten (letzte 30 Tage)
christina
christina am 10 Jan. 2019
Beantwortet: Moreno, M. am 20 Mär. 2022
How to generate N random uniformly distributed points in the d - ball

Antworten (2)

Bruno Luong
Bruno Luong am 10 Jan. 2019
Bearbeitet: Bruno Luong am 10 Jan. 2019
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. am 20 Mär. 2022
https://uk.mathworks.com/matlabcentral/fileexchange/108374-uniformly-distributed-points

Kategorien

Mehr zu Random Number Generation finden Sie in Help Center und File Exchange

Produkte


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by