trace — trace
trace(X)
trace(X) is the trace of the matrix X.
Same as sum(diag(X)).
A=rand(3,3); trace(A)-sum(spec(A))