How to make a normal distribution using the following parameters: mean, standard error, minimum, and maximum?
2 次查看(过去 30 天)
显示 更早的评论
I need to create a 400x1 array that contains a normal distribution with a mean of 100, minimum of around 50 and maximum of around 150. I also have a standard error value of 0.05. I have tried creating a random number generator using normfit with mu = 100 and SD = 0.05. However, this just gives me a distribution with 400 elements all +/- 0.05 away from 100. I need a distribution that has the highest frequency around 100 and the lowest/highest around 50 and 150, respectivley. The SE isnt as important to me.
3 个评论
Torsten
2022-10-19
Then play with the variance to get the histogram you like.
If the random numbers must all lie in [50 150], use a truncated normal:
回答(1 个)
dpb
2022-10-19
" have a standard error value of 0.05."
I have always heard "standard error" as being the std/mean -- using 0.05 as the standard deviation would imply
Z=(150-100)/0.05
for which
1-normcdf(Z)
is so small as to be returned as identically zero.
OTOH, if it is a standard error of 5%, then the std dev would be 0.05*100 --> 5 and
Z=(150-100)/5
for which
1-normcdf(Z)
which is also still far too small for a normal to have any significant probability of values out that far.
The 95% Z values for a normal is
z=norminv([0.95 0.975])
for one-sided or two-sided respectively, for which then the std deviation of your sampled distribution would need to be
s=(150-100)./z
histfit(randn(400,1)*s(2)+100)
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!