rcond

Reciprocal condition number

Description

example

````C = rcond(A)` returns an estimate for the reciprocal condition of `A` in 1-norm. If `A` is well conditioned, `rcond(A)` is near 1.0. If `A` is badly conditioned, `rcond(A)` is near 0. ```

Examples

collapse all

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 H(i,j) = 1/(i + j -1).

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, so `A` is badly conditioned.

The condition of `A` has an effect on the solutions of similar linear systems of equations. To see this, compare the solution of Ax = b to that of the perturbed system, Ax = b + 0.01.

Create a column vector of ones and solve Ax = b.

```b = ones(10,1); x = A\b;```

Now change b by `0.01` and solve the perturbed system.

```b1 = b + 0.01; x1 = A\b1;```

Compare the solutions, `x` and `x1`.

```norm(x-x1) ```
```ans = 1.1250e+05```

Since `A` is badly conditioned, a small change in `b` produces a very large change (on the order of 1e5) in the solution to x = A\b. The system 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 calculating `svd(A)`.

Calculate the determinant of `A`.

`det(A)`
```ans = 1.0000e-10```

Although the determinant of the matrix is close to zero, `A` is actually very well conditioned and not close to being singular.

Calculate the reciprocal condition number of `A`.

`rcond(A)`
```ans = 1 ```

The matrix has a reciprocal condition number of `1` and is, therefore, very well conditioned. Use `rcond(A)` or `cond(A)` rather than `det(A)` to confirm singularity of a matrix.

Input Arguments

collapse all

`A` — Input matrixsquare numeric matrix

Input matrix, specified as a square numeric matrix.

Data Types: `single` | `double`

Output Arguments

collapse all

`C` — Reciprocal condition numberscalar

Reciprocal condition number, returned as a scalar. The data type of `C` is the same as `A`.

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.

collapse all

Tips

• `rcond` is a more efficient but less reliable method of estimating the condition of a matrix compared to the condition number, `cond`.