How to generate a vector of random numbers whose total must be equal to 1?
1 回表示 (過去 30 日間)
古いコメントを表示
I want to generate a random vector. if i add all the values in the generated vector, its sum should be equal to 1.
0 件のコメント
回答 (1 件)
James Tursa
2020 年 3 月 4 日
See this FEX submission by Roger Stafford:
4 件のコメント
James Tursa
2020 年 3 月 4 日
... sigh ...
Then transpose the result:
s = randfixedsum(3,1,1,0,1)';
参考
カテゴリ
Help Center および File Exchange で Random Number Generation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!