svd

Singular value decomposition.

Syntax

S = svd(A)

[U,S,V] = svd(A)

[U,S,V] = svd(A,econ)

Inputs

A
The matrix to decompose.
Dimension: matrix
econ
Economy decomposition flag. Set to 0.
Type: integer
Dimension: scalar

Outputs

U
Matrix of left singular vectors.
Dimension: matrix
S
Singular value diagonal matrix.
Type: double
Dimension: matrix
V
Matrix of right singular vectors.
Dimension: matrix

Example

Economy svd example.

[U,S,V] = svd([1,2,3;4,5,6;7,8,10;11,12,15],0)
U = [Matrix] 4 x 3
-0.12878   0.91972   0.34283
-0.31141   0.23912  -0.87513
-0.51828   0.08294  -0.06716
-0.78602  -0.30011   0.33482
S = [Matrix] 3 x 3
28.15923  0.00000  0.00000
 0.00000  0.99730  0.00000
 0.00000  0.00000  0.25179
V = [Matrix] 3 x 3
-0.48469  -0.84674   0.21934
-0.54664   0.09748  -0.83167
-0.68283   0.52301   0.51011

Comments

[U,S,V] = svd(A) computes matrices U, S and V such that A = U*S*V'. For the economy decomposition of an mxn matrix A with m>n, U is mxn, with both S and V being nxn.

svd uses the LAPACK routines 'dgesvd' for real matrices and 'zgesvd' for complex matrices.