COND Condition Number of a Matrix

Section: Array Generation and Manipulations


Calculates the condition number of a matrix. To compute the 2-norm condition number of a matrix (ratio of largest to smallest singular values), use the syntax
   y = cond(A)

where A is a matrix. If you want to compute the condition number in a different norm (e.g., the 1-norm), use the second syntax

   y = cond(A,p)

where p is the norm to use when computing the condition number. The following choices of p are supported

Function Internals

The condition number is defined as

This equation is precisely how the condition number is computed for the case p ~= 2. For the p=2 case, the condition number can be computed much more efficiently using the ratio of the largest and smallest singular values.


The condition number of this matrix is large
--> A = [1,1;0,1e-15]

A = 
    1.0000    1.0000 
         0    0.0000 

--> cond(A)

ans = 

--> cond(A,1)

ans = 

You can also (for the case p=1 use rcond to calculate an estimate of the condition number

--> 1/rcond(A)

ans =