Section: Transforms/Decompositions
svd
function has three forms. The first returns only the singular
values of the matrix:
s = svd(A)
The second form returns both the singular values in a diagonal
matrix S
, as well as the left and right eigenvectors.
[U,S,V] = svd(A)
The third form returns a more compact decomposition, with the left and right singular vectors corresponding to zero singular values being eliminated. The syntax is
[U,S,V] = svd(A,0)
sigma_i
is a singular value of an M x N
matrix A
if there exists two vectors u_i, v_i
where u_i
is
of length M
, and v_i
is of length u_i
and
and generally
where K
is the rank of A
. In matrix form, the left singular
vectors u_i
are stored in the matrix U
as
The matrix S
is then of size M x N
with the singular
values along the diagonal. The SVD is computed using the
LAPACK
class of functions GESDD
.
--> A = float(randn(2,3)) A = <float> - size: [2 3] Columns 1 to 3 -1.04076362 -1.61856449 0.55819988 0.24222484 -1.26936078 -2.91016126 --> [U,S,V] = svd(A) U = <float> - size: [2 2] Columns 1 to 2 0.029025719 0.999578655 0.999578655 -0.029025720 S = <float> - size: [2 3] Columns 1 to 3 3.1849895 0.0000000 0.0000000 0.0000000 2.0023384 0.0000000 V = <float> - size: [3 3] Columns 1 to 3 0.06653523 -0.52306640 0.84969091 -0.41312730 -0.78959608 -0.45372224 -0.90823942 0.32084200 0.26862893 --> U*S*V' ans = <float> - size: [2 3] Columns 1 to 3 -1.04076362 -1.61856461 0.55819988 0.24222496 -1.26936090 -2.91016126 --> svd(A) ans = <float> - size: [2 1] Columns 1 to 1 3.1849895 2.0023384