I'm trying to create a random log-normal distributions for a vector . I have already read the lognrnd document as https://uk.mathworks.com/help/stats/lognrnd.html.and other people who ask a similar question but I'm a bit confused since the document is a bit confusing for me. So, I understand to use lognrnd as R = lognrnd(mu,sigma), both mu and sigma has to be mean and standard deviation of the normal distribution, let us call it Y. The corresponding lognormal distribution of X is Y. To use lognrnd from its given X (lognormal distribution) mean (m) and X variance (v), we should find the mu and sigma first by using these formula as
mu = log((m^2)/sqrt(v+m^2));
sigma = sqrt(log(v/(m^2)+1));
Now, this is clear for me but the confusing part in the document is the following sentence "If X is distributed lognormally with parameters µ and σ, then log(X) is distributed normally with mean µ and standard deviation σ"
Should not be if X is distributed lognormally with parameters m and v since µ and σ represent only the normal distribution?
I have listed what I'm trying to do just to be clear about my understanding and for confirmation about how to estimate random distribution from given mean and standard deviation of the log normal distribution:
m = 14;
std_d = 7;
v = std_d^2;
mu = log((m.^2)./ sqrt(v+m.^2));
sigma = sqrt(log(v./(m.^2)+1));
R = lognrnd(mu,sigma,10^6,1);
Thanks for your help and reading this.