trace
Matrix trace.
📝Syntax
res = trace(x)
📥Input Arguments
Parameter Description
x a numeric value: scalar or matrix (double or single)
📤Output Arguments
Parameter Description
res a numeric value: a scalar
📄Description

trace(x) computes the trace of x, the sum of the elements along the main diagonal.

💡Examples
X = [1 0; 0 3];
Y = trace(X)
🔗See Also
eig
🕔Version History
Version Description
1.0.0 initial version
Edit this page on GitHub