Complementary error function
erfc(
returns the Complementary Error Function evaluated
for each element of x
)x
. Use the erfc
function
to replace 1 - erf(x)
for greater accuracy when erf(x)
is
close to 1
.
You can also find the standard normal probability
distribution using the function normcdf
(Statistics and Machine Learning Toolbox). The relationship between the error
function erfc
and normcdf
is
For expressions of the form 1 - erfc(x)
,
use the error function erf
instead.
This substitution maintains accuracy. When erfc(x)
is
close to 1
, then 1 - erfc(x)
is
a small number and might be rounded down to 0
.
Instead, replace 1 - erfc(x)
with erf(x)
.
For expressions of the form exp(x^2)*erfc(x)
,
use the scaled complementary error function erfcx
instead.
This substitution maintains accuracy by avoiding roundoff errors for
large values of x
.