フィルターのクリア

How can I calculate Global stiffness matrix?

3 ビュー (過去 30 日間)
Merve Ala
Merve Ala 2023 年 1 月 13 日
コメント済み: Merve Ala 2023 年 1 月 14 日
I have two basic matrix and I want to sum them in C matrix like below picture. I added A matrix but I couldn't add B matrix in that way. What can ı do?
C = zeros (6,6)
A = [ 1 2 3 4 ;
4 5 6 7 ;
7 8 9 10 ;
10 11 12 13 ]
B = [ 5 7 8 4 ;
4 5 6 7 ;
7 8 9 10 ;
10 11 12 13 ]
for x = 1:1:6
C(x:2*x+2,x:2*x+2)=C(x:2*x+2,x:2*x+2)+A(x:2*x+2,x:2*x+2) %+B ?
end

採用された回答

Cameron
Cameron 2023 年 1 月 13 日
I don't remember everything from my FEA classes, but I think this is what you're looking for
C = zeros(6,6);
A = [ 1 2 3 4 ;
4 5 6 7 ;
7 8 9 10 ;
10 11 12 13 ];
B = [ 5 7 8 4 ;
4 5 6 7 ;
7 8 9 10 ;
10 11 12 13 ];
C(1:4,1:4) = A;
C(3:6,3:6) = C(3:6,3:6) + B;
disp(C)
1 2 3 4 0 0 4 5 6 7 0 0 7 8 14 17 8 4 10 11 16 18 6 7 0 0 7 8 9 10 0 0 10 11 12 13
  1 件のコメント
Merve Ala
Merve Ala 2023 年 1 月 14 日
Thank you so much it helped a lot :)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by