Multidimensional Arrays Global stiff matrix
1 回表示 (過去 30 日間)
古いコメントを表示
Shing Kwan Tang
2020 年 9 月 8 日
回答済み: Sulaymon Eshkabilov
2020 年 9 月 8 日
Do anyone know how to make a Multidimensional Arrays GSM, cause I have already make a 2x2 Local Stiff matrix. But I am confuse on make a GSM with for loop. And here is my code for LSM and vaeiables. Thank you
%Step 1 Discretize
%Assign Variables
E = young;
A = area;
L = leng;
F1 = F;
Num_elements = no_e;
l = L/Num_elements ;
K = E*A/l ;
%step 2 Local Behavior
% Form local stiffness Matrixes
LSM = zeros(2, 2, Num_elements);
for x=1: 1: Num_elements
LSM(1,1,x)= K(x,1);
LSM(1,2,x)= -K(x,1);
LSM(2,1,x)= -K(x,1);
LSM(2,2,x)= K(x,1);
end
%Step 3
%Assemble Global Stiffness Matrix (GSM)
0 件のコメント
採用された回答
Sulaymon Eshkabilov
2020 年 9 月 8 日
Substitute this portion of your code:
LSM = zeros(2, 2, Num_elements);
for x=1: Num_elements
LSM(1,1)= K;
LSM(1,2)= -K;
LSM(2,1)= -K;
LSM(2,2)= K;
end
With this one:
LSM(1,1)= K;
LSM(1,2)= -K;
LSM(2,1)= -K;
LSM(2,2)= K;
0 件のコメント
その他の回答 (1 件)
Sulaymon Eshkabilov
2020 年 9 月 8 日
Here is the GSM created in loops:
LSM(1,1)= K;
LSM(1,2)= -K;
LSM(2,1)= -K;
LSM(2,2)= K;
GSM = zeros(Num_elements);
for ii=1:Num_elements-1
ROW = ii + [0 1];
COL = ROW;
GSM(ROW, COL) = GSM(ROW, COL)+LSM;
end
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!