trace
Compute the trace of a matrix, the sum of the diagonal elements.
Syntax
R = trace(A)
Inputs
- A
- Dimension: matrix
Outputs
- R
- The trace.
Examples
R = trace([1,2,3;4,5,6;7,8,9])
R = 15
Compute the trace of a matrix, the sum of the diagonal elements.
R = trace(A)
R = trace([1,2,3;4,5,6;7,8,9])
R = 15