calculate the condition number of the matrix in matlab

To calculate the condition number of a matrix in MATLAB, you can use the cond function.

Here is the syntax:

main.m
cond(A)
8 chars
2 lines

Where A is the matrix for which you want to calculate the condition number.

The cond function returns the 2-norm condition number by default. If you want to calculate a different norm condition number, you can specify it as a second argument. For example, to calculate the 1-norm condition number:

main.m
cond(A, 1)
11 chars
2 lines

The condition number represents the sensitivity of a linear system to changes in the input matrix. A higher condition number indicates a more ill-conditioned system, meaning that small changes in the input matrix can cause large changes in the solution.

gistlibby LogSnag