Azzera filtri
Azzera filtri

How to do sum of diagonal element of a matrix?

1 visualizzazione (ultimi 30 giorni)
Nadhirah Jofri
Nadhirah Jofri il 8 Ago 2015
Risposto: Walter Roberson il 8 Ago 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)' ?

Risposte (2)

Azzi Abdelmalek
Azzi Abdelmalek il 8 Ago 2015

Walter Roberson
Walter Roberson il 8 Ago 2015
sum(diag(A))

Categorie

Scopri di più su Operating on Diagonal Matrices in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by