erfc
Complementary error function
📝Syntax
R = erfc(X)
📥Input Arguments
Parameter Description
X a real single or real double scalar, vector, matrix, or multidimensional array. Sparse and complex inputs are not supported.
📤Output Arguments
Parameter Description
R complementary error function values, returned with the same size and floating-point class as X.
📄Description

erfc computes the complementary error function element by element.

The complementary error function is defined as:

$$erfc(x) = \frac{2}{\sqrt{\pi}}\int_x^{\infty} e^{-t^2}\,dt$$

It is related to the error function by:

$$erfc(x) = 1 - erf(x)$$

Use erfc instead of 1 - erf(x) when erf(x) is close to 1, because direct subtraction can lose significant digits.

Use erfcx instead of exp(x^2) * erfc(x) for large positive values of X.

💡Examples
Find the complementary error function of a scalar.
R = erfc(0.35)
Find the complementary error function of the elements of a vector.
V = [-0.5 0 1 0.72];
R = erfc(V)
Find the complementary error function of the elements of a matrix.
M = [0.29 -0.11; 3.1 -2.9];
R = erfc(M)
Compare direct subtraction with erfc for a large positive input.
A = 1 - erf(10);
B = erfc(10);
🔗See Also
erferfcinverfcxerfinv
🕔Version History
Version Description
1.17.0 initial version
Edit this page on GitHub