# svd

Singular Value Decomposition.

## Syntax

* s = svd(M)
* \[U, S, V] = svd(M)
* \[U, S, V] = svd(M, 0)
* \[U, S, V] = svd(M, 'econ')

## Input argument

* M - a numeric value: matrix (double or single)

## Output argument

* s - real vector (singular values) by descending order.
* U - left singular values.
* S - real diagonal matrix (singular values)
* V - right singular values.

## Description

**\[U, S, V] = svd(M)** produces a diagonal matrix S of the same dimension as M and with nonnegative diagonal elements in decreasing order, and unitary matrices U and V so that X = U\*S\*V'.

**\[U, S, V] = svd(M, 0)** produces the 'economy size' decomposition. If M is m-by-n with m > n then only the first n columns of U are computed and S is n-by-n.

**\[U, S, V] = svd(M,0)** produces a different economy-size decomposition of m-by-n matrix M. If m > n then svd(M, 0) is equivalent to svd(M,'econ'). If m <= n then svd(M, 0) is equivalent to svd(M).

## Example

```matlab
X = eye(3, 3);
s = svd(X)
[U, S, V] = svd(X)
```

## See also

[eig](eig).

## History

| Version | Description     |
| ------- | --------------- |
| 1.0.0   | initial version |

## Author

Allan CORNET
