Multidimensional Arrays Global stiff matrix
Show older comments
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)
Accepted Answer
More Answers (1)
Sulaymon Eshkabilov
on 8 Sep 2020
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
1 Comment
Shing Kwan Tang
on 8 Sep 2020
Categories
Find more on Numerical Integration and Differential Equations 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!