Documentation

This is machine translation

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

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

normpdf

Normal probability density function

Syntax

Y = normpdf(X,mu,sigma)
Y = normpdf(X)
Y = normpdf(X,mu)

Description

Y = normpdf(X,mu,sigma) computes the pdf at each of the values in X using the normal distribution with mean mu and standard deviation sigma. X, mu, and sigma can be vectors, matrices, or multidimensional arrays that all have the same size. A scalar input is expanded to a constant array with the same dimensions as the other inputs. The parameters in sigma must be positive.

The normal pdf is

y=f(x|μ,σ)=1σ2πe(xμ)22σ2

The likelihood function is the pdf viewed as a function of the parameters. Maximum likelihood estimators (MLEs) are the values of the parameters that maximize the likelihood function for a fixed value of x.

The standard normal distribution has µ = 0 and σ = 1.

If x is standard normal, then xσ + µ is also normal with mean µ and standard deviation σ. Conversely, if y is normal with mean µ and standard deviation σ, then x = (yµ) / σ is standard normal.

Y = normpdf(X) uses the standard normal distribution (mu = 0, sigma = 1).

Y = normpdf(X,mu) uses the normal distribution with unit standard deviation (sigma = 1).

Examples

mu = [0:0.1:2];
[y i] = max(normpdf(1.5,mu,1));
MLE = mu(i)
MLE =
  1.5000

Extended Capabilities

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

Introduced before R2006a

Was this topic helpful?