Sigma Multiple Matrix for Loop
古いコメントを表示
Hi, I have a question. I wanna write code for matlab with this formula.

I confused in loop. My code:
A = [ 0.1 0.2 0.3 0.4
0.4 0.5 0.6 0.7
0.8 0.9 1.0 1.0
0.8 0.9 1.0 1.0];
[i,h]=size(A);
B = [ 0 1 0 1 0 1
1 0 0 1 0 0
0 0 1 1 0 0
1 0 0 0 0 1];
[h,j]=size(B);
mat=zeros(i,j);
temp=zeros(i,j);
for c=[1:j]
for r=[1:i]
temp(r,c)=A(r,r)*B(r,c);
mat=mat+temp;
end
end
I'm not sure of this code, is this right?
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!