How to do sum of diagonal element of a matrix?

1 次查看(过去 30 天)
from what i know to do sum of diagonal element of a matrix is by:
tr(A)
but it says
Undefined function or method 'tr' for input arguments of type 'double'.
so i think i should do it manually by using the 'diag(A)'.. but...how i'm going to do 'sum of diag(A)' ?

回答(2 个)

Azzi Abdelmalek
Azzi Abdelmalek 2015-8-8

Walter Roberson
Walter Roberson 2015-8-8

类别

Help CenterFile Exchange 中查找有关 Operating on Diagonal Matrices 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by