normal random number generator with specified zone
2 ビュー (過去 30 日間)
古いコメントを表示
Hi dear i have a problem with normal random number. generator.i need to use this generator for normally distribution but my related variable will be negative.so i need to restrict random numbers that generate by that between -1 and 1...could i have use uniform dist.instead of that with some mathematical change????please help me on that..
0 件のコメント
回答 (2 件)
Andrew Newell
2011 年 2 月 25 日
If a uniform distribution will do, you could try
rand*2-1
1 件のコメント
Mario Reutter
2018 年 8 月 22 日
If "normal-distribution-like" properties are desired (symmetric and max density at center; but no points of inflection!):
betarnd(2, 2) * 2 - 1
the cyclist
2011 年 2 月 25 日
Your question is not very clear, at least to me. It seems that you are asking for things that cannot all be true at the same time:
- normally distributed
- between -1 and 1
- uniformly distributed
Also, you mention a "related variable," but's it's not clear what you mean by that.
So, I think you should try to provide a lot more detail about what you are trying to do, and what you want your distribution to look like. (A picture might help, if you can add one.)
Finally, many times when someone wants a distribution that is "sort of like a normal distribution" but has a finite range, they can use the beta distribution. The command in MATLAB is "betarnd".
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!