erf

Error function of real values.

Category: Mathematics > Elementary Math

Syntax

Y = erf(X)

Returns the error function of each element of X.

Description

erf(x) is 2/sqrt(pi) times the integral of exp(-t^2) from 0 to x. It is odd, increases from -1 to 1, and erf(Inf) is 1. For a normal distribution with mean 0 and standard deviation 1, the cumulative probability is 0.5*(1 + erf(x/sqrt(2))).

Input arguments

X
Real numeric array of any size.

Output arguments

Y
Array of the same size as X.

Example

Error function and the normal CDF

erf([0 0.5 Inf])
0.5*(1 + erf(1/sqrt(2)))
Output
ans = 1×3

         0    0.5205    1.0000
ans = 0.8413

Notes

The input must be real. Complex input raises the error "Input must be real and full."

See also

erfc erfcinv erfinv