rcond
Reciprocal condition number
Syntax
Description
Examples
Sensitivity of Badly Conditioned Matrix
Examine the sensitivity of a badly conditioned matrix.
A notable matrix that is symmetric and positive definite, but badly conditioned, is the Hilbert matrix. The elements of the Hilbert matrix are 。
Create a 10-by-10 Hilbert matrix.
A = hilb(10);
Find the reciprocal condition number of the matrix.
C = rcond(A)
C = 2.8286e-14
The reciprocal condition number is small, soA
is badly conditioned.
The condition ofA
has an effect on the solutions of similar linear systems of equations. To see this, compare the solution of
to that of the perturbed system,
。
创建一个列向量的和求解e 。
b = ones(10,1); x = A\b;
Now change
by0.01
and solve the perturbed system.
b1 = b + 0.01; x1 = A\b1;
Compare the solutions,x
andx1
。
norm(x-x1)
ans = 1.1250e+05
SinceA
is badly conditioned, a small change inb
produces a very large change (on the order of 1e5) in the solution tox = A\b
。系统m is sensitive to perturbations.
Find Condition of Identity Matrix
Examine why the reciprocal condition number is a more accurate measure of singularity than the determinant.
Create a 5-by-5 multiple of the identity matrix.
A = eye(5)*0.01;
This matrix is full rank and has five equal singular values, which you can confirm by calculatingsvd(A)
。
Calculate the determinant ofA
。
det(A)
ans = 1.0000e-10
Although the determinant of the matrix is close to zero,A
is actually very well conditioned andnotclose to being singular.
Calculate the reciprocal condition number ofA
。
rcond(A)
ans = 1
The matrix has a reciprocal condition number of1
and is, therefore, very well conditioned. Usercond(A)
orcond(A)
rather thandet(A)
to confirm singularity of a matrix.
Input Arguments
A
—Input matrix
square numeric matrix
Input matrix, specified as a square numeric matrix.
Data Types:single
|double
Output Arguments
C
— Reciprocal condition number
scalar
Reciprocal condition number, returned as a scalar. The data type ofC
is the same asA
。
The reciprocal condition number is a scale-invariant measure of how close a given matrix is to the set of singular matrices.
If
C
is near 0, the matrix is nearly singular and badly conditioned.If
C
is near 1.0, the matrix is well conditioned.
Tips
rcond
is a more efficient but less reliable method of estimating the condition of a matrix compared to the condition number,cond
。
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Usage notes and limitations:
Code generation does not support sparse matrix inputs for this function.
GPU Code Generation
Generate CUDA® code for NVIDIA® GPUs using GPU Coder™.
Usage notes and limitations:
Code generation does not support sparse matrix inputs for this function.
Introduced before R2006a
Open Example
A modified version of this example exists on your system. Do you want to open this version instead?
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select:。
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina(Español)
- Canada(English)
- United States(English)
Europe
- Belgium(English)
- Denmark(English)
- Deutschland(Deutsch)
- España(Español)
- Finland(English)
- France(Français)
- Ireland(English)
- Italia(Italiano)
- Luxembourg(English)
- Netherlands(English)
- Norway(English)
- Österreich(Deutsch)
- Portugal(English)
- Sweden(English)
- Switzerland
- United Kingdom(English)