| Contents | Index |
erf(x)
erf(A)
erf(x) computes the error function of x.
erf(A) computes the error function of each element of A.
Calling erf for a number that is not a symbolic object invokes the MATLAB erf function. This function accepts real arguments only. If you want to compute the error function for a complex number, use sym to convert that number to a symbolic object, and then call erf for that symbolic object.
x |
Symbolic number, variable, or expression. |
A |
Vector or matrix of symbolic numbers, variables, or expressions. |
The following integral defines the error function:
![]()
Compute the error function for these numbers. Because these numbers are not symbolic objects, you get the floating-point results:
[erf(1/2), erf(1.41), erf(sqrt(2))]
ans =
0.5205 0.9539 0.9545Compute the error function for the numbers converted to symbolic objects. For most symbolic (exact) numbers, erf returns unresolved symbolic calls:
[erf(sym(1/2)), erf(sym(1.41))]
ans = [ erf(1/2), erf(141/100)]
Compute the error function for x = 0, x = ∞, and x = –∞. The error function has special values for these parameters:
[erf(0), erf(inf), erf(-inf)]
ans =
0 1 -1Compute the error function for complex infinities. Use sym to convert complex infinities to symbolic objects:
[erf(sym(i*inf)), erf(sym(-i*inf))]
ans = [ Inf*i, -Inf*i]
Compute the error function for x and sin(x) + x*exp(x). For most symbolic variables and expressions, erf returns unresolved symbolic calls:
syms x f = sin(x) + x*exp(x); erf(x) erf(f)
ans = erf(x) ans = erf(sin(x) + x*exp(x))
Now compute the derivatives of these expressions:
diff(erf(x), x, 2) diff(erf(f), x)
ans = -(4*x*exp(-x^2))/pi^(1/2) ans = (2*exp(-(sin(x) + x*exp(x))^2)*(cos(x) + exp(x) + x*exp(x)))/pi^(1/2)
Compute the error function for elements of matrix M and vector V:
M =sym([0 inf; 1/3 -inf]); V = sym([1; -i*inf]); erf(M) erf(V)
ans = [ 0, 1] [ erf(1/3), -1] ans = erf(1) -Inf*i
The toolbox can simplify expressions that contain error functions and their inverses. For real values x, the toolbox applies these simplification rules:
erfinv(erf(x)) = erfinv(1 - erfc(x)) = erfcinv(1 - erf(x)) = erfcinv(erfc(x)) = x
erfinv(-erf(x)) = erfinv(erfc(x) - 1) = erfcinv(1 + erf(x)) = erfcinv(2 - erfc(x)) = -x
For any value x, the system applies these simplification rules:
erfcinv(x) = erfinv(1 - x)
erfinv(-x) = -erfinv(x)
erfcinv(2 - x) = -erfcinv(x)
erf(erfinv(x)) = erfc(erfcinv(x)) = x
erf(erfcinv(x)) = erfc(erfinv(x)) = 1 - x
Gautschi, W. "Error Function and Fresnel Integrals." Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. (M. Abramowitz and I. A. Stegun, eds.). New York: Dover, 1972.

See how symbolic computations can help you find analytical solutions to math and engineering problems.
Get free kit| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |