Syntax
Y = erf(X) Error function
Y = erfc(X) Complementary error function
Y = erfcx(X) Scaled complementary error function
X = erfinv(Y) Inverse error function
X = erfcinv(Y) Inverse complementary error function
Definition
The error function erf(X)
is twice the integral of the Gaussian distribution with 0 mean and variance of .
The complementary error function erfc(X)
is defined as
The scaled complementary error function erfcx(X)
is defined as
For large X
, erfcx(X)
is approximately
Description
Y = erf(X)
returns the value of the error function for each element of real array X
.
Y = erfc(X)
computes the value of the complementary error function.
Y = erfcx(X)
computes the value of the scaled complementary error function.
X = erfinv(Y)
returns the value of the inverse error function for each element of Y
. Elements of Y
must be in the interval [-1 1]
. The function erfinv
satisfies for and .
X = erfcinv(Y)
returns the value of the inverse of the complementary error function for each element of Y
. Elements of Y
must be in the interval [0 2]
. The function erfcinv
satisfies for and .
Remarks
The relationship between the complementary error function erfc
and the standard normal probability distribution returned by the Statistics Toolbox function normcdf
is
The relationship between the inverse complementary error function erfcinv
and the inverse standard normal probability distribution returned by the Statistics Toolbox function norminv
is
Examples
For abs(Y)
>
1
, erfinv(Y)
is NaN
.
Syntax
error('message')
error('message',a1,a2, ...)
error('message_id','message')
error('message_id','message',a1,a2,...)
Description
error('message')
displays an error message and returns control to the keyboard. The error message contains the input string message
.
The error
command has no effect if message
is a null string.
error('message',a1,a2,...)
displays a message string that contains formatting conversion characters, such as those used with the MATLAB sprintf
function. Each conversion character in message
is converted to one of the values a1, a2, ...
in the argument list.
Note MATLAB converts special characters (like \n and %d ) in the error message string only when you specify more than one input argument with error . See Example 3 below. |
error('message_id','message')
attaches a unique message identifier, or message_id
, to the error message. The identifier enables you to better identify the source of an error.
error('message_id','message',a1,a2, ...)
includes formatting conversion characters in message
, and the character translations a1, a2, ...
Example 1
The error
function provides an error return from M-files:
The returned error message looks like this:
Example 2
Specify a message identifier and error message string with error
:
In your error handling code, use lasterr
to determine the message identifier and error message string for the failing operation:
[errmsg, msgid] = lasterr
errmsg =
The angle specified must be less than 90 degrees.
msgid =
MyToolbox:angleTooLarge
Example 3
MATLAB converts special characters (like \n
and %d
) in the error message string only when you specify more than one input argument with error
. In the single argument case shown below, \n
is taken to mean backslash-n
. It is not converted to a newline character:
error('In this case, the newline \n is not converted.')
??? In this case, the newline \n is not converted.
But, when more than one argument is specified, MATLAB does convert special characters. This holds true regardless of whether the additional argument supplies conversion values or is a message identifier:
error('ErrorTests:convertTest', ...
'In this case, the newline \n is converted.')
??? In this case, the newline
is converted.
errorbar
Syntax
Description
Error bars show the confidence level of data or the deviation along a curve.
errorbar(Y,E)
plots Y
and draws an error bar at each element of Y
. The error bar is a distance of E(i)
above and below the curve so that each bar is symmetric and 2*E(i)
long.
errorbar(X,Y,E)
plots X
versus Y
with symmetric error bars 2*E(i)
long. X
, Y
, E
must be the same size. When they are vectors, each error bar is a distance of E(i)
above and below the point defined by (X(i),Y(i))
. When they are matrices, each error bar is a distance of E(i,j)
above and below the point defined by (X(i,j),Y(i,j))
.
errorbar(X,Y,L,U)
plots X
versus Y
with error bars L(i)+U(i)
long specifying the lower and upper error bars. X
, Y
, L
, and U
must be the same size. When they are vectors, each error bar is a distance of L(i)
below and U(i)
above the point defined by (X(i),Y(i))
. When they are matrices, each error bar is a distance of L(i,j)
below and U(i,j)
above the point defined by (X(i,j),Y(i,j))
.
errorbar(...,
draws the error bars using the line type, marker symbol, and color specified by LineSpec
) LineSpec
.
h = errorbar(...)
returns a vector of handles to line graphics objects.
Remarks
When the arguments are all matrices, errorbar
draws one line per matrix column. If X
and Y
are vectors, they specify one curve.
Examples
Draw symmetric error bars that are two standard deviation units in length.
errordlg
Create and display an error dialog box
Syntax
errordlg
errordlg('errorstring
')
errordlg('errorstring
','dlgname
')
errordlg('errorstring
','dlgname
','on')
h = errordlg(...)
Description
errordlg
creates an error dialog box, or if the named dialog exists, errordlg
pops the named dialog in front of other windows.
errordlg
displays a dialog box named 'Error Dialog'
that contains the string 'This is the default error string.'
errordlg('
displays a dialog box named errorstring
') 'Error Dialog'
that contains the string 'errorstring'
.
errordlg('
displays a dialog box named errorstring
','dlgname
') 'dlgname'
that contains the string 'errorstring'
.
errordlg('
specifies whether to replace an existing dialog box having the same name. errorstring
','dlgname
','on') 'on'
brings an existing error dialog having the same name to the foreground. In this case, errordlg
does not create a new dialog.
h = errordlg(...)
returns the handle of the dialog box.
Remarks
MATLAB sizes the dialog box to fit the string 'errorstring'
. The error dialog box has an OK pushbutton and remains on the screen until you press the OK button or the Return key. After pressing the button, the error dialog box disappears.
The appearance of the dialog box depends on the windowing system you use.
Examples
No comments:
Post a Comment