MATLAB矩阵计算。

9 Ansichten (letzte 30 Tage)
bacesa
bacesa am 21 Nov. 2022
Beantwortet: dajihov am 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
这是怎么计算的啊?

Akzeptierte Antwort

dajihov
dajihov am 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]

Weitere Antworten (0)

Kategorien

Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!