= MATLAB svd = The '''`svd`''' function calculates the [[LinearAlgebra/SingularValueDecomposition|SVD decomposition]] of any matrix. <> ---- == Usage == To solve the problem `Ax = b` for any size matrix `A`, try: {{{ [U, S, V] = svd(A); S_inv = diag(1./diag(S)); x = V * S_inv * U' * b; }}} This is effectively what [[MATLAB/Pinv|pinv]] does. To calculate the rank ''k'' [[LinearAlgebra/LowRankApproximation|approximation]] of a matrix `A`, try: {{{ [U, S, V] = svd(A); U_k = U(:, 1:k) S_k = S(1:k, 1:k) V_k = V(:, 1:k) A_k = U_k * S_k * V_k' }}} The original `A` can be returned by `U*S*V'`. ---- CategoryRicottone