# 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)

`A`- Dimension: matrix

- R
- The trace.

`R = trace([1,2,3;4,5,6;7,8,9])`

`R = 15`