Main Content

lognpdf

Lognormal probability density function

Description

y= lognpdf(x)returns the probability density function (pdf) of the standard lognormal distribution, evaluated at the values inx. In the standard lognormal distribution, the mean and standard deviation of logarithmic values are 0 and 1, respectively.

y= lognpdf(x,mu)returns the pdf of the lognormal distribution with the distribution parametersmu(mean of logarithmic values) and 1 (standard deviation of logarithmic values), evaluated at the values inx.

example

y= lognpdf(x,mu,sigma)returns the pdf of the lognormal distribution with the distribution parametersmu(mean of logarithmic values) andsigma(standard deviation of logarithmic values), evaluated at the values inx.

Examples

collapse all

Compute the pdf values evaluated at the values inxfor the lognormal distribution with meanmuand standard deviationsigma.

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

Plot the pdf.

plot(x,y) gridonxlabel('x') ylabel('y')

Input Arguments

collapse all

Values at which to evaluate the pdf, specified as a positive scalar value or an array of positive scalar values.

To evaluate the pdf at multiple values, specifyxusing an array. To evaluate the pdfs of multiple distributions, specifymuandsigmausing arrays. If one or more of the input argumentsx,mu, andsigmaare arrays, then the array sizes must be the same. In this case,lognpdfexpands each scalar input into a constant array of the same size as the array inputs.Each element inyis the pdf value of the distribution specified by the corresponding elements inmuandsigma, evaluated at the corresponding element inx.

Example:[-1,0,3,4]

Data Types:single|double

Mean of logarithmic values for the lognormal distribution, specified as a scalar value or an array of scalar values.

To evaluate the pdf at multiple values, specifyxusing an array. To evaluate the pdfs of multiple distributions, specifymuandsigmausing arrays. If one or more of the input argumentsx,mu, andsigmaare arrays, then the array sizes must be the same. In this case,lognpdfexpands each scalar input into a constant array of the same size as the array inputs.Each element inyis the pdf value of the distribution specified by the corresponding elements inmuandsigma, evaluated at the corresponding element inx.

Example:[0 1 2; 0 1 2]

Data Types:single|double

Standard deviation of logarithmic values for the lognormal distribution, specified as a positive scalar value or an array of positive scalar values.

To evaluate the pdf at multiple values, specifyxusing an array. To evaluate the pdfs of multiple distributions, specifymuandsigmausing arrays. If one or more of the input argumentsx,mu, andsigmaare arrays, then the array sizes must be the same. In this case,lognpdfexpands each scalar input into a constant array of the same size as the array inputs.Each element inyis the pdf value of the distribution specified by the corresponding elements inmuandsigma, evaluated at the corresponding element inx.

Example:[1 1 1; 2 2 2]

Data Types:single|double

Output Arguments

collapse all

pdf values, evaluated at the values inx, returned as a scalar value or an array of scalar values.yis the same size asx,mu, andsigmaafter any necessary scalar expansion.Each element inyis the pdf value of the distribution specified by the corresponding elements inmuandsigma, evaluated at the corresponding element inx.

More About

collapse all

Lognormal Distribution

The lognormal distribution is a probability distribution whose logarithm has a normal distribution.

The probability density function (pdf) of the lognormal distribution is

y = f ( x | μ , σ ) = 1 x σ 2 π exp { ( log x μ ) 2 2 σ 2 } , for x > 0.

Alternative Functionality

  • lognpdfis a function specific to lognormal distribution. Statistics and Machine Learning Toolbox™ also offers the generic functionpdf支持各种概率金宝appability distributions. To usepdf, create aLognormalDistributionprobability distribution object and pass the object as an input argument or specify the probability distribution name and its parameters. Note that the distribution-specific functionlognpdfis faster than the generic functionpdf.

  • Use theProbability Distribution Functionapp to create an interactive plot of the cumulative distribution function (cdf) or probability density function (pdf) for a probability distribution.

References

[1] Mood, A. M., F. A. Graybill, and D. C. Boes.Introduction to the Theory of Statistics.3rd ed., New York: McGraw-Hill, 1974. pp. 540–541.

[2] Evans, M., N. Hastings, and B. Peacock.Statistical Distributions. 2nd ed., Hoboken, NJ: John Wiley & Sons, Inc., 1993.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Introduced before R2006a