Generate a random number from the mean and standard deviation of a lognormal distribution

4 views (last 30 days)
I have calculated the Mean and Standard deviation from a list which fits to a lognormal distribution.
The values of mean and standard deviation are: 31.59299751 and 69.72271594 respectively.
I want to generate one random number to be given as an input.
Note: With the use of lognrnd(mu,sigma); I get strange values like 2.33+e^15, etc. Whereas, I require a number around the mean of the distribution (for e.g. 50.334, etc.)

Accepted Answer

Shashank Prasanna
Shashank Prasanna on 1 Jul 2013
You need to compute the mean and sigma of the log normal distribution:
m=31.59299751;
s=69.72271594;
mu = log(m^2/sqrt(s+m^2))
sigma = sqrt(log(1+s/m^2))
lognrnd(mu,sigma)
  6 Comments
Ashish
Ashish on 5 Jul 2013
@ Shashank- Though I understood the concept you explained before, I need to still clear one doubt.
I derived the Mean as - 11.5hrs and standard deviation as- 9.14 hrs from the MLE approach I mentioned before. (The parameters are that of a lognormal distribution.)
[I understand the reason for such high standard dev. is the less number of raw inputs. Also, the values are quite varying.]
THe question is- My model needs ONLY one value of time (ONE INPUT) taking the mean and st. dev. both. Which Matlab function should be used then? (For e.g. a value like (11.5 +/- 9.14)hrs.

Sign in to comment.

More Answers (1)

Image Analyst
Image Analyst on 1 Jul 2013
Might be of interest: http://www.mathworks.com/matlabcentral/fileexchange/7309-randraw Generates random numbers from over 50 different distributions.

Community Treasure Hunt

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

Start Hunting!