stats::normalPDF

Probability density function of the normal distribution

MuPAD® notebooks will be removed in a future release. 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.

Syntax

stats::normalPDF(m, v)

Description

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

of the normal distribution with mean m and variance v.

The procedure f := stats::normalPDF(m, v) can be called in the form f(x) with an arithmetical expression x. The value exp(-(x - m)^2/(2*v))/sqrt(2*PI*v) 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.

Examples

Example 1

We compute the probability density with mean m = 2 and variance v = 4 at various points:

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

delete f:

Example 2

We use symbolic arguments:

f := stats::normalPDF(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:

Parameters

m

The mean: an arithmetical expression representing a real value

v

The variance: an arithmetical expression representing a positive real value

Return Values

procedure.