Random Points in an n-Dimensional Hypersphere

Randomly and uniformly distributes points throughout a hypersphere.
4.4K Downloads
Updated 28 Dec 2005

No License

This creates a set of random points defined by Cartesian coordinates and uniformly distributed over the interior of an n-dimensional hypersphere of radius r with center at the origin.

The 'randn' function is first used to create independent multivariate normally distributed sets of n random variables, each representing points in n-dimensional space. The incomplete gamma function, 'gammainc', is then used to map these points radially to the interior of an n-dimensional hypersphere of finite radius r in such a way as to be spatially uniformly distributed.

Cite As

Roger Stafford (2024). Random Points in an n-Dimensional Hypersphere (https://www.mathworks.com/matlabcentral/fileexchange/9443-random-points-in-an-n-dimensional-hypersphere), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R10
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on GPU Computing in Help Center and MATLAB Answers

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes
1.0.0.0