Generate Random Numbers such that Sum of their Squares is 1 ???
3 次查看(过去 30 天)
显示 更早的评论
Hey all ,,
I would like to generate random numbers ( Normal Distribution) Such that their sum of Squares should be one .... Can any one suggest some idea
???/
1 个评论
Roger Stafford
2014-11-29
This is an impossible request. Having a sum of squares be one requires that the numbers be bounded. Having a normal distribution requires that values are unbounded. You can't have both.
回答(1 个)
Roger Stafford
2014-11-29
If you drop any requirement of having a "normal" distribution, you can do this:
x = randn(n,1);
x = x/sqrt(sum(x.^2));
The sum of the squares of the n elements in x will always be 1.
0 个评论
另请参阅
类别
在 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!