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

mathematicsstatistics

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.)

Best Answer

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)