Documentation

erfcinv

Inverse complementary error function

Syntax

Description

example

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.

Examples

collapse all

Find Inverse Complementary Error Function

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 =

       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 =

    1.1631   -0.1791
         0    0.0889

Avoid Roundoff Errors Using Inverse Complementary Error Function

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

Show how to avoid roundoff 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)
erfcinv(x)
ans =

   Inf


ans =

   15.0656

Input Arguments

collapse all

x — Inputreal number | vector of real numbers | matrix of real numbers | multidimensional array of real numbers

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 Statistics and Machine Learning Toolbox™ function norminv. 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).

See Also

| | |

Introduced before R2006a

Was this topic helpful?