Sum of diagonal elements
Syntax
b = trace(A)
Description
b = trace(A) is the sum of the diagonal elements of the matrix A.
A
Algorithm
trace is a single-statement M-file.
trace
t = sum(diag(A));
See Also
det, eig
det
eig
© 1994-2005 The MathWorks, Inc.