nsphrand
Uniformly distributed random numbers which fulfill the condition r_min < r_rand < r_max of an n-sphere
nsphrand([M N D]) or nsphrand(M,N,D) generates an M-by-N matrix of random numbers with the dimensionality D where D can for instance be one of the following:
D=1 => 0-sphere (line)
D=2 => 1-sphere (circle)
D=3 => 2-sphere (sphere)
etc
The components of the last dimension D is the vector of the sphere, which length can thus be interpreted as the radius.
r = nsphrand(...,'Rmin',rmin,'Rmax',rmax) sets the min and max radius for the generated random numbers (default 0 and 1).
Example:
r = nsphrand(10000, 1, 2, 'Rmin', 1, 'Rmax', 2)
plot(r(:,1),r(:,2),'.')
Cite As
Urban Eriksson (2024). nsphrand (https://www.mathworks.com/matlabcentral/fileexchange/69909-nsphrand), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
- Aerospace and Defense > Aerospace Blockset > Standard Workflow Procedures > Coordinate Systems > Axes Transformations >
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
Version | Published | Release Notes | |
---|---|---|---|
1.0.0 |