pracma (version 1.9.9)

Trace: Matrix trace

Description

Sum of the main diagonal elements.

Usage

Trace(a)

Arguments

a
a square matrix

Value

scalar value

Details

Sums the elements of the main diagonal of areal or complrx square matrix.

See Also

Diag, diag

Examples

Run this code
Trace(matrix(1:16, nrow=4, ncol=4))

Run the code above in your browser using DataCamp Workspace