<< Matrix Analysis Matrix Analysis det >>

Scilab Help >> Linear Algebra > Matrix Analysis > cond

cond

condition number of a matrix

Syntax

c = cond(X)
c = cond(X, p)

Arguments

X

real or complex matrix. For the c = cond(X,p) syntax, X must be square.

p

1 | 2 | %inf | "inf" | "fro": Used norm. Default value = 2.

c

positive decimal number: the condition number.

Description

c = cond(X)

returns condition number in 2-norm.cond(X) is the ratio of the largest singular value of X to the smallest.

c = cond(X, p)

returns the condition number in p-norm : norm(X, p) * norm(inv(X), p). p possible values are:

1 : condition number in 1-norm.
2 : condition number in 2-norm.
%inf | "inf" : condition number in infinite norm
"fro" : condition number in Frobenius norm

Examples

// Condition number of a non-square matrix
cond([1 0 -1 ; 0 1 -1])

A = testmatrix('hilb',6);
// condition number in 2-norm
cond(A)
cond(A, 2)

// condition number in 1-norm
cond(A, 1)

// condition number in infinity norm
cond(A, %inf)

// condition number in Frobenius norm
cond(A, 'fro')

See also

History

VersionDescription
5.4.0
  • cond(X) now accepts non square matrix.
  • New input argument p introduced.
6.0.2 cond([]) now returns 0 instead of 1.

Report an issue
<< Matrix Analysis Matrix Analysis det >>