Borrar filtros
Borrar filtros

How to do sum of diagonal element of a matrix?

1 visualización (últimos 30 días)
Nadhirah Jofri
Nadhirah Jofri el 8 de Ag. de 2015
Respondida: Walter Roberson el 8 de Ag. de 2015
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)' ?

Respuestas (2)

Azzi Abdelmalek
Azzi Abdelmalek el 8 de Ag. de 2015

Walter Roberson
Walter Roberson el 8 de Ag. de 2015
sum(diag(A))

Categorías

Más información sobre Operating on Diagonal Matrices en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by