Generate N random uniformly distributed points in the d-ball

5 visualizaciones (últimos 30 días)
christina
christina el 10 de En. de 2019
Respondida: Moreno, M. el 20 de Mzo. de 2022
How to generate N random uniformly distributed points in the d - ball

Respuestas (2)

Bruno Luong
Bruno Luong el 10 de En. de 2019
Editada: Bruno Luong el 10 de En. de 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. el 20 de Mzo. de 2022
https://uk.mathworks.com/matlabcentral/fileexchange/108374-uniformly-distributed-points

Categorías

Más información sobre Random Number Generation en Help Center y File Exchange.

Productos


Versión

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by