MATLAB矩阵计算。
18 views (last 30 days)
Show older comments
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
这是怎么计算的啊?
0 Comments
Accepted Answer
dajihov
on 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]
0 Comments
More Answers (0)
See Also
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!