assemble global stiffness matrix

1 回表示 (過去 30 日間)
Rafael Zanetti
Rafael Zanetti 2020 年 4 月 16 日
回答済み: Ameer Hamza 2020 年 4 月 16 日
Hello, I'd like how the easier way to assemble 2 matrices, for example, I have the following matrices:
k1 = [120 -120;-120 120]
k = zeros(5,5)
so I want to assemble this pattern:
K = [120 0 -120 0 0; 0 0 0 0 0;-120 0 120 0 0; 0 0 0 0 0; 0 0 0 0 0]
I thank you.

採用された回答

Ameer Hamza
Ameer Hamza 2020 年 4 月 16 日
k1 = [120 -120;-120 120];
k = zeros(5,5);
k([1 3], [1 3]) = k1;
Result
k =
120 0 -120 0 0
0 0 0 0 0
-120 0 120 0 0
0 0 0 0 0
0 0 0 0 0

その他の回答 (0 件)

カテゴリ

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

製品

Community Treasure Hunt

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

Start Hunting!

Translated by