trace

Sum of diagonal elements

Syntax

b = trace(A)

Description

b = trace(A) is the sum of the diagonal elements of the matrix A.

Algorithms

t = sum(diag(A));

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

See Also

|

Introduced before R2006a

Was this topic helpful?