DEVv2 Matlab Code For Computing FEM
DEVv2 Matlab Code For Computing FEM
clc
%Creation of the global stiffness matrix from the local rigidity matrixes and the
%rotation matrix
T = [c s 0 0 ; -s c 0 0 ;
0 0 c s ; 0 0 -s c ]; % 4x4 Rotation matrix
% The following code is able to make the assembly operation of the global
rigidity matrix
i1=2*(elem(ielem,1)-1)+1; % degree of freedom X node i
i2=i1+1; % degree of freedom Y node i
j1=2*(elem(ielem,2)-1)+1; % degree of freedom X node j
j2=j1+1; % degree of freedom X node j
% Assembly process
K_(i1:i2,i1:i2) = K_(i1:i2,i1:i2) + k_ei(1:2,1:2); % Assembly 1st quadrant
K_(i1:i2,j1:j2) = K_(i1:i2,j1:j2) + k_ei(1:2,3:4); % Assembly 2nd quadrant
K_(j1:j2,i1:i2) = K_(j1:j2,i1:i2) + k_ei(3:4,1:2); % Assembly 3rd quadrant
K_(j1:j2,j1:j2) = K_(j1:j2,j1:j2) + k_ei(3:4,3:4); % Assembly 4th quadrant
end
positionx1=2*((bar1)-1)+1;
positiony1=positionx1+1;
positionx2=2*((bar2)-1)+1;
positiony2=positionx2+1;
u2global(1)=u(positionx2);
u2global(2)=u(positiony2);
u2local=u2global*R;
resultant2=u2local(1);