Products & Services Solutions Academia Support User Community Company

Learn more about Symbolic Math Toolbox   

svd - Compute singular value decomposition of symbolic matrix

Syntax

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

Description

sigma = svd(A) returns a symbolic vector containing the singular values of a symbolic matrix A. With symbolic inputs, svd does not accept complex values as inputs.

sigma = svd(vpa(A)) returns a vector with the numeric singular values using variable precision arithmetic.

[U, S, V] = svd(A) and [U, S, V] = svd(vpa(A)) return numeric unitary matrices U and V with the columns containing the singular vectors and a diagonal matrix S containing the singular values. The matrices satisfy A = U*S*V'. The svd command does not compute symbolic singular vectors. With multiple outputs, svd does not accept complex values as inputs.

Examples

Compute the symbolic and numeric singular values and the numeric singular vectors of the following magic square:

digits(5)
A = sym(magic(4));
svd(A)
svd(vpa(A))
[U, S, V] = svd(A)

The results are:

ans = 
         0
 2*5^(1/2)
 8*5^(1/2)
        34

ans =
           34.0
         17.889
         4.4721
 2.8024*10^(-7)

U =
[ 0.5,  0.67082,  0.5,  0.22361]
[ 0.5, -0.22361, -0.5,  0.67082]
[ 0.5,  0.22361, -0.5, -0.67082]
[ 0.5, -0.67082,  0.5, -0.22361]
 
S =
[ 34.0,      0,      0, 0]
[    0, 17.889,      0, 0]
[    0,      0, 4.4721, 0]
[    0,      0,      0, 0]
 
V =
[ 0.5,  0.5,  0.67082,  0.22361]
[ 0.5, -0.5, -0.22361,  0.67082]
[ 0.5, -0.5,  0.22361, -0.67082]
[ 0.5,  0.5, -0.67082, -0.22361]

See Also

digits | eig | inv | vpa

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS