Random numbers within a specific range

2 次查看(过去 30 天)
Hi,
I would like to know how is possible to generate random draws from a normal distribution , where the rv has a specific range.
say within a closed interval [-5, 5].
Thanks
  2 个评论
Brendan Hamm
Brendan Hamm 2015-4-26
Well this would no longer be statistically normally distributed as the support is infinite.
msh
msh 2015-4-26
True, I modified my question to be more precise.

请先登录,再进行评论。

采纳的回答

Star Strider
Star Strider 2015-4-26
Considering that:
p = normpdf([-5, 5], 0, 1)
produces:
p =
1.4867e-006 1.4867e-006
so the randn function will produce normally-distributed random variables on the interval (-5,+5) with a probability of about 0.999997 or so.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Random Number Generation 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by