MATLAB矩阵计算。

18 vues (au cours des 30 derniers jours)
bacesa
bacesa le 21 Nov 2022
p=[1 2;1 2];
i=1:2;j=1:2;
s=sum(p(i,j)) 结果为s=2 4
s=sum(p(i,j)*p(i,j)) 结果为s=6 12
这是怎么计算的啊?

Réponse acceptée

dajihov
dajihov le 21 Nov 2022
p定义为一个2*2的矩阵,i为一个1*2的数组, j也是一个1*2的数组
p(i,j)就是就是相当于p矩阵本身,i,j为索引
sum(p(i,j))就是矩阵p的每列相加,就是[2,4]的矩阵
p(i,j)*p(i,j)又是一个2*2的矩阵[3 6;3 6],加上后就是[6 12]

Plus de réponses (0)

Catégories

En savoir plus sur Matrix Indexing dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!