Random Vectors with Fixed Sum

版本 1.0.0.0 (8.2 KB) 作者: Roger Stafford
Randomly and uniformly generates vectors with a specified sum and values in a specified interval.
10.1K 次下载
更新时间 2006/1/24

无许可证

编者注: This file was a File Exchange Pick of the Week

This generates m random n-element column vectors of values, [x1;x2;...;xn], each with a fixed sum, s, and subject to a restriction a<=xi<=b. The vectors are randomly and uniformly distributed in the n-1 dimensional space of solutions. This is accomplished by decomposing that space into a number of different types of simplexes (the many-dimensional generalizations of line segments, triangles, and tetrahedra.) The 'rand' function is used to distribute vectors within each simplex uniformly, and further calls on 'rand' serve to select different types of simplexes with probabilities proportional to their respective n-1 dimensional volumes. This algorithm does not perform any rejection of solutions - all are generated so as to already fit within the prescribed hypercube.

引用格式

Roger Stafford (2024). Random Vectors with Fixed Sum (https://www.mathworks.com/matlabcentral/fileexchange/9700-random-vectors-with-fixed-sum), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R10
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Performance 的更多信息
致谢

启发作品: portfolio_sortino_ratio

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
1.0.0.0