Main Content

erfcinv

Inverse complementary error function

Description

erfcinv(x) returns the value of the Inverse Complementary Error Function for each element of x. For inputs outside the interval [0 2], erfcinv returns NaN. Use the erfcinv function to replace expressions containing erfinv(1-x) for greater accuracy when x is close to 1.

example

Examples

collapse all

erfcinv(0.3)
ans = 
0.7329

Find the inverse complementary error function of the elements of a vector.

V = [-10 0 0.5 1.3 2 Inf];
erfcinv(V)
ans = 1×6

       NaN       Inf    0.4769   -0.2725      -Inf       NaN

Find the inverse complementary error function of the elements of a matrix.

M = [0.1 1.2; 1 0.9];
erfcinv(M)
ans = 2×2

    1.1631   -0.1791
         0    0.0889

You can use the inverse complementary error function erfcinv in place of erfinv(1-x) to avoid round-off errors when x is close to 0.

Show how to avoid round-off errors by calculating erfinv(1-x) using erfcinv(x) for x = 1e-100. The original calculation returns Inf while erfcinv(x) returns the correct result.

x = 1e-100;
erfinv(1-x)
ans = 
Inf
erfcinv(x)
ans = 
15.0656

Input Arguments

collapse all

Input, specified as a real number, or a vector, matrix, or multidimensional array of real numbers. x cannot be sparse.

Data Types: single | double

More About

collapse all

Inverse Complementary Error Function

The inverse complementary error function erfcinv(x) is defined as erfcinv(erfc(x))=x.

Tips

  • You can also find the inverse standard normal probability distribution using the function norminv (Statistics and Machine Learning Toolbox). The relationship between the inverse complementary error function erfcinv and norminv is

    norminv(p)=(2)×erfcinv(2p).

  • For expressions of the form erfcinv(1-x), use the inverse error function erfinv instead. This substitution maintains accuracy. When x is close to 1, then 1 - x is a small number and might be rounded down to 0. Instead, replace erfcinv(1-x) with erfinv(x).

Extended Capabilities

Version History

Introduced before R2006a

See Also

| | |