This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.


Probability density function of the log-normal distribution

MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.


stats::lognormalPDF(m, v)


stats::lognormalPDF(m, v) returns a procedure representing the probability density function

of the lognormal distribution with location parameter m and shape parameter v.

A random variable X is log-normally distributed if ln(X) is a normally distributed variable. The "location parameter" m of X is the mean of ln(X) and the "shape parameter" v is the variance of ln(X).

The procedure f := stats::lognormalPDF(m, v) can be called in the form f(x) with an arithmetical expression x. The value is returned.

If x is a floating-point number and both m and v can be converted to floating-point numbers, this value is returned as a floating-point number. Otherwise, a symbolic expression is returned.

Numerical values for m and v are only accepted if they are real and v is positive.

Environment Interactions

The function is sensitive to the environment variable DIGITS which determines the numerical working precision.


Example 1

We compute the probability density with location parameter m = 2 and shape parameter v = 4 at various points:

f := stats::lognormalPDF(2, 4):
f(-infinity), f(-3), f(2.0), f(PI), f(infinity)

delete f:

Example 2

We use symbolic arguments:

f := stats::lognormalPDF(m, v):
f(x), f(0.4)

When numerical values are assigned to m and v, the function f starts to produce numerical values:

m := PI: v := 2:
f(3), f(3.0)

delete f, m, v:

Example 3

The following plot shows the influence of the shape parameter on the log-normal distribution:

plotfunc2d(stats::lognormalPDF(1, 0.25)(x),
           stats::lognormalPDF(1, 0.5)(x),
           stats::lognormalPDF(1, 1)(x),
           stats::lognormalPDF(1, 2)(x),
           stats::lognormalPDF(1, 4)(x),
           stats::lognormalPDF(1, 8)(x),
           x = -0.5 .. 4, ViewingBoxYRange = 0 .. 1.1,
           LegendVisible = FALSE)

Due to its logarithmic influence, the location parameter changes the shape of the distribution, too:

plotfunc2d(stats::lognormalPDF(m, 0.5)(x) $ m = 0.5..2 step 0.5,
           x = -0.5 ..4, ViewingBoxYRange = 0 .. 0.5,
           LegendVisible = FALSE)



The location parameter: an arithmetical expression representing a real value


The shape parameter: an arithmetical expression representing a positive real value

Return Values


Was this topic helpful?