Skip to content

svd

Singular value decomposition.

S = svd(X)
[U, S, V] = svd(X)
[U, S, V] = svd(X, 0) % economy size
[U, S, V] = svd(X, 'econ') % economy size

Computes the SVD of X: orthogonal/unitary U, diagonal nonnegative S, orthogonal/unitary V such that X = U*S*V'. With one return, gives just the singular values as a vector.

The economy form (passing 0 or 'econ' as the second argument) returns U and V truncated to the smaller dimension — significantly cheaper for tall or wide matrices.

[U, S, V] = svd([1 2; 3 4; 5 6]);
size(U) % [3 3] full form
[U, S, V] = svd([1 2; 3 4; 5 6], 'econ');
size(U) % [3 2] economy
  • eig — Eigenvalues and eigenvectors.
  • qr — QR decomposition.
  • rank — Numerical rank of a matrix.
  • norm — Vector or matrix norm.
  • cond — Condition number of a matrix.