Note: This page has been translated by MathWorks. Click here to see

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

The normal pdf is

$$y=f(x|\mu ,\sigma )=\frac{1}{\sigma \sqrt{2\pi}}{e}^{\frac{-{(x-\mu )}^{2}}{2{\sigma}^{2}}}.$$

The normal distribution is a two-parameter family of curves. The first parameter,
*µ*, is the mean. The second, *σ*, is the
standard deviation. The standard normal distribution (written
Φ(*x*)) sets *µ* to 0 and
*σ* to 1.

Φ(*x*) is functionally related to the error function,
*erf*.

$$erf\left(x\right)=2\Phi \left(x\sqrt{2}\right)-1$$

The first use of the normal distribution was as a continuous approximation to the binomial.

The usual justification for using the normal distribution for modeling is the Central Limit Theorem, which states (roughly) that the sum of independent samples from any distribution with finite mean and variance converges to the normal distribution as the sample size goes to infinity.

To use statistical parameters such as mean and standard deviation reliably, you
need to have a good estimator for them. The maximum likelihood estimates (MLEs)
provide one such estimator. However, an MLE might be biased, which means that its
expected value of the parameter might not equal the parameter being estimated. For
example, an MLE is biased for estimating the variance of a normal distribution. An
unbiased estimator that is commonly used to estimate the parameters of the normal
distribution is the *minimum variance unbiased estimator*
(*MVUE*). The MVUE has the minimum variance of all unbiased
estimators of a parameter.

The MVUEs of parameters *µ* and
*σ*^{2} for the normal distribution
are the sample mean and variance. The sample mean is also the MLE for
*µ*. The following are two common formulas for the variance.

$${s}^{2}=\frac{1}{n}{\displaystyle \sum _{i=1}^{n}{\left({x}_{i}-\overline{x}\right)}^{2}}$$ | (1) |

$${s}^{2}=\frac{1}{n-1}{\displaystyle \sum _{i=1}^{n}{\left({x}_{i}-\overline{x}\right)}^{2}}$$ | (2) |

where

$$\overline{x}={\displaystyle \sum _{i=1}^{n}\frac{{x}_{i}}{n}}$$

Equation 1 is the maximum likelihood estimator for
*σ*^{2}, and equation 2 is the
MVUE.

To fit the normal distribution to data and find the parameter estimates, use
`normfit`

, `fitdist`

, or `mle`

.

For uncensored data,

`normfit`

and`fitdist`

find the unbiased estimates of the distribution parameters, and`mle`

finds the maximum likelihood estimates.For censored data,

`normfit`

,`fitdist`

, and`mle`

find the maximum likelihood estimates.

Unlike `normfit`

and `mle`

,
which return parameter estimates, `fitdist`

returns the fitted
probability distribution object `NormalDistribution`

. The object properties `mu`

and
`sigma`

of store the parameter estimates.

As an example, suppose you want to estimate the mean, *µ*, and
the variance, *σ*^{2}, of the heights of
all fourth grade children in the United States. The function `normfit`

returns the MVUE for *µ*, the square root
of the MVUE for *σ*^{2}, and confidence
intervals for *µ* and
*σ*^{2}. Here is a playful example
modeling the heights in inches of a randomly chosen fourth grade class.

rng default; % For reproducibility height = normrnd(50,2,30,1); % Simulate heights [mu,s,muci,sci] = normfit(height)

mu = 51.1038

s = 2.6001

`muci = `*2×1*
50.1329
52.0747

`sci = `*2×1*
2.0707
3.4954

Note that `s^2`

is the MVUE of the variance.

s^2

ans = 6.7605

Compute the pdf of a standard normal distribution, with parameters equal to 0 and equal to 1.

x = [-3:.1:3]; norm = normpdf(x,0,1);

Plot the pdf.

figure; plot(x,norm)