Function Reference: lognpdf

statistics: y = lognpdf (x)
statistics: y = lognpdf (x, mu)
statistics: y = lognpdf (x, mu, sigma)

Lognormal probability density function (PDF).

For each element of x, compute the probability density function (PDF) of the lognormal distribution with mean parameter mu and standard deviation parameter sigma, each corresponding to the associated normal distribution. The size of y is the common size of p, mu, and sigma. A scalar input functions as a constant matrix of the same size as the other inputs.

If a random variable follows this distribution, its logarithm is normally distributed with mean mu and standard deviation sigma.

Default parameter values are mu = 0 and sigma = 1. Both parameters must be reals and sigma > 0. For sigma <= 0, NaN is returned.

Further information about the lognormal distribution can be found at https://en.wikipedia.org/wiki/Log-normal_distribution

See also: logncdf, logninv, lognrnd, lognfit, lognlike, lognstat

Source Code: lognpdf

Example: 1

 

 ## Plot various PDFs from the log-normal distribution
 x = 0:0.01:5;
 y1 = lognpdf (x, 0, 1);
 y2 = lognpdf (x, 0, 0.5);
 y3 = lognpdf (x, 0, 0.25);
 plot (x, y1, "-b", x, y2, "-g", x, y3, "-r")
 grid on
 ylim ([0, 2])
 legend ({"μ = 0, σ = 1", "μ = 0, σ = 0.5", "μ = 0, σ = 0.25"}, ...
          "location", "northeast")
 title ("Log-normal PDF")
 xlabel ("values in x")
 ylabel ("density")

                    
plotted figure