Accelerating the pace of engineering and science

Documentation Center

• Trial Software

lognpdf

Lognormal probability density function

Syntax

Y = lognpdf(X,mu,sigma)

Description

Y = lognpdf(X,mu,sigma) returns values at X of the lognormal pdf with distribution parameters mu and sigma. mu and sigma are the mean and standard deviation, respectively, of the associated normal distribution. X, mu, and sigma can be vectors, matrices, or multidimensional arrays that all have the same size, which is also the size of Y. A scalar input for X, mu, or sigma is expanded to a constant array with the same dimensions as the other inputs.

The lognormal pdf is

The normal and lognormal distributions are closely related. If X is distributed lognormally with parameters µ and σ, then log(X) is distributed normally with mean µ and standard deviation σ.

The mean m and variance v of a lognormal random variable are functions of µ and σ that can be calculated with the lognstat function. They are:

A lognormal distribution with mean m and variance v has parameters

The lognormal distribution is applicable when the quantity of interest must be positive, since log(X) exists only when X is positive.

Examples

expand all

Compute the Lognormal Distribution pdf

Compute the pdf of a lognormal distribution with mu = 0 and sigma = 1.

```x = (0:0.02:10);
y = lognpdf(x,0,1);
```

Plot the pdf.

```plot(x,y); grid;
xlabel('x'); ylabel('p')
```