R = erf(X)
| Parameter | Description |
|---|---|
| X | a real single or real double scalar, vector, matrix, or multidimensional array. Sparse and complex inputs are not supported. |
| Parameter | Description |
|---|---|
| R | error function values, returned with the same size and floating-point class as X. |
erf computes the error function element by element.
The error function is defined as:
$$erf(x) = \frac{2}{\sqrt{\pi}}\int_0^x e^{-t^2}\,dt$$It is related to the complementary error function by:
$$erfc(x) = 1 - erf(x)$$For better numerical accuracy when the result is close to zero, use erfc instead of evaluating 1 - erf(x).
R = erf(0.76)
V = [-0.5 0 1 0.72];
R = erf(V)
M = [0.29 -0.11; 3.1 -2.9];
R = erf(M)
x = -3:0.1:3;
y = 0.5 * (1 + erf(x / sqrt(2)));
| Version | Description |
|---|---|
| 1.17.0 | initial version |