Section: Array Generation and Manipulations
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
p = 1 returns the 1-norm, or the max column sum of A
p = 2 returns the 2-norm (largest singular value of A)
p = inf returns the infinity norm, or the max row sum of A
p = 'fro' returns the Frobenius-norm (vector Euclidean norm, or RMS value)
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.
--> A = [1,1;0,1e-15] A = <double> - size: [2 2] Columns 1 to 2 1.000000000000000 1.000000000000000 0.000000000000000 0.000000000000001 --> cond(A) ans = <double> - size: [1 1] 2000000000000000 --> cond(A,1) ans = <double> - size: [1 1] 2000000000000002
You can also (for the case p=1 use rcond to calculate an estimate
of the condition number
--> 1/rcond(A) ans = <double> - size: [1 1] 2000000000000001.8