MATLAB Functions Help Desk

erf, erfc, erfcx, erfinv

Purpose

Error functions

Syntax

Definition

The error function erf(X) is defined as the integral of the Gaussian distribution function from 0 to x:

The complementary error function erfc(X) is defined as:

The scaled complementary error function erfcx(X) is defined as:

For large X, erfcx(X) is approximately

.

Description

Y = erf(X) returns the value of the error function for each element of real array X.

Y = erfc(X) computes the value of the complementary error function.

Y = erfcx(X) computes the value of the scaled complementary error function.

X = erfinv(Y) returns the value of the inverse error function for each element of Y. The elements of Y must fall within the domain

Examples

erfinv(1) is Inf

erfinv(-1) is -Inf.

For abs(Y) > 1, erfinv(Y) is NaN.

Remarks

The relationship between the error function and the standard normal probability distribution is:

Algorithms

For the error functions, the MATLAB code is a translation of a Fortran program by W. J. Cody, Argonne National Laboratory, NETLIB/SPECFUN, March 19, 1990. The main computation evaluates near-minimax rational approximations from [1].

For the inverse of the error function, rational approximations accurate to approximately six significant digits are used to generate an initial approximation, which is then improved to full accuracy by two steps of Newton's method. The M-file is easily modified to eliminate the Newton improvement. The resulting code is about three times faster in execution, but is considerably less accurate.

References

[1] Cody, W. J., "Rational Chebyshev Approximations for the Error Function," Math. Comp., pgs. 631-638, 1969



[ Previous | Help Desk | Next ]