Compute the singular value decomposition of a
The function
svd
normally returns the vector of singular values. If asked for three return values, it computes For example,svd (hilb (3))returns
ans = 1.4083189 0.1223271 0.0026873and
[u, s, v] = svd (hilb (3))returns
u = -0.82704 0.54745 0.12766 -0.45986 -0.52829 -0.71375 -0.32330 -0.64901 0.68867 s = 1.40832 0.00000 0.00000 0.00000 0.12233 0.00000 0.00000 0.00000 0.00269 v = -0.82704 0.54745 0.12766 -0.45986 -0.52829 -0.71375 -0.32330 -0.64901 0.68867If given a second argument,
svd
returns an economy-sized decomposition, eliminating the unnecessary rows or columns of u or v.