normally distributed demand data

3 views (last 30 days)
bus14 on 24 Apr 2019
Commented: bus14 on 25 Apr 2019
Hi community,
I would like to make a normal random distribution for a demand set in Matlab with a range from [0 100]. However, I can not come up with a good working good yet. Does anyone have an idea how to do this?
bus14 on 24 Apr 2019
preferably values should be integers as it concerns ordering of products. It would also be fine if the values be in the 100s. However values of 1000+ I cannot use

Sign in to comment.

Accepted Answer

Rik on 24 Apr 2019
You can use the randn function to generate random numbers.
n=300;%number of cases
minval=0;%lowest allowed integer
maxval=1000;%highest allowed integer
mu=50;%median value of distribution
sd=50;%standard deviation of distribution
data=floor(mu+sd*randn(n,1));%round down to integers
invalid= data<minval | data>maxval;
while any(invalid)
%replace invalid values with newly generated values
%this will bias the distribution
invalid= data<minval | data>maxval;

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!