trace

Purpose

Trace of a matrix.

Synopsis

t = trace(A)

Description

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

Algorithm

trace is a single-statement M-file.

t = sum(diag(A));

See Also

det, eig

(c) Copyright 1994 by The MathWorks, Inc.