<< svd linear algebra

trace


Matrix trace.


Syntax


res = trace(x)

Input argument


x

a numeric value: scalar or matrix (double or single)

Output argument


res

a numeric value: a scalar

Description


trace(x) computes the trace of x, the sum of the elements along the main diagonal.

Example


X = [1 0; 0 3];
Y = trace(X)

See also


eig.

History


Version Description
1.0.0 initial version

Author


Allan CORNET

<< svd linear algebra