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)

 채택된 답변

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2020년 9월 8일

0 개 추천

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;

추가 답변 (1개)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2020년 9월 8일

0 개 추천

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

do the COL and ROW need to put the number i want. cause when I run the code, it give me an error say that
lab_2_part_3(50, 60, 55, 60,5)
Unable to perform assignment because the size of the left side is 2-by-2 and the size of the right side is 2-by-2-by-5.
Error in lab_2_part_3 (line 38)
GSM(ROW, COL) = GSM(ROW, COL)+LSM;
my whole code is like this ;
function [ displacements, external_Forces] = lab_2_part_3(E ,A ,L ,F1 ,Num_elements)
%Step 1 Discretize
%Assign Variables
E = young;
A = area;
L = len;
F1 = force;
Num_elements = no_ele;
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: Num_elements
LSM(1,1)= K;
LSM(1,2)= -K;
LSM(2,1)= -K;
LSM(2,2)= K;
end
%Step 3
%Assemble Global Stiffness Matrix (GSM)
GSM = zeros(Num_elements);
for y=1:Num_elements-1
ROW = y + [0 1];
COL = ROW;
GSM(ROW, COL) = GSM(ROW, COL)+LSM;
end
%Step 4
%Apply Boundary Conditions
F1 = [60 ; 0 ; 0 ];
LSM = GSM (1:end-1 ,1:end-1);
% Step 5
%solve for unknown displacements
mini_U = LSM \ external_Forces;
%step 6
% Analyze and find Reaction Forces
displacements = mini_U;
external_Forces = [60 ; 0 ;0 ; -60];
end

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Numerical Integration and Differential Equations에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by