IGNORE IF YOU DONT HAVE MATLAB Obtain the assembled global s
IGNORE IF YOU DON\'T HAVE MATLAB
Obtain the assembled global stiffness matrix [k] and the global force vector {f} by hand using 1D linear FEM elements for the case of N_e = 3. Compute [C] and use it to assemble [K]. Assume the element stiffness matrices are. [K]^1_(2 times 2) = [8 -4 -4 4] [K]^2_(2 times 2) = [2 -1 -1 1] [K]^3_(2 times 2) = [1/2 -1/4 -1/4 1/4] Assume the elements force vectors are. {f}^1_(2 times 1) = {100 150) {f}^2_(2 times 1) = {250 150) {f}^3_(2 times 1) = {850 1650) 2. Obtain the assembled global stiffness matrix [K]_(N times N) using MATLAB for a uniform discretization of the bar problem using ID linear FEM elements and the following problem data. Print out [K] for the cases N_e = 4, 8, 16. 0 lessthanorequalto x lessthanorequalto l, A(x) = 1, L = 1, E = 1Solution
% ****1st question***** %
numnod=4;
numele=3;
bigk=[zeros(numnod,numnod)]; % zero bigk matrix to prepare for assembly
force=[zeros(1,numnod)];%force matrix
node= [1:numele; 2:numele+1];
%first element
e=1;
ke=[8,-4;-4,4];
fe=[100,150];
bigk(node(1,e),node(1,e))=bigk(node(1,e),node(1,e))+ke(1,1);
bigk(node(1,e),node(2,e))=bigk(node(1,e),node(2,e))+ke(1,2);
bigk(node(2,e),node(1,e))=bigk(node(2,e),node(1,e))+ke(2,1);
bigk(node(2,e),node(2,e))=bigk(node(2,e),node(2,e))+ke(2,2);
force(e)=force(e)+fe(1);
force(e+1)=force(e+1)+fe(2);
%second element
e=2;
ke=[2,-1;-1,1];
fe=[250,450];
bigk(node(1,e),node(1,e))=bigk(node(1,e),node(1,e))+ke(1,1);
bigk(node(1,e),node(2,e))=bigk(node(1,e),node(2,e))+ke(1,2);
bigk(node(2,e),node(1,e))=bigk(node(2,e),node(1,e))+ke(2,1);
bigk(node(2,e),node(2,e))=bigk(node(2,e),node(2,e))+ke(2,2);
force(e)=force(e)+fe(1);
force(e+1)=force(e+1)+fe(2);
%third element
e=3;
ke=[1/2,-1/4;-1/4,1/4];
fe=[850,1650];
bigk(node(1,e),node(1,e))=bigk(node(1,e),node(1,e))+ke(1,1);
bigk(node(1,e),node(2,e))=bigk(node(1,e),node(2,e))+ke(1,2);
bigk(node(2,e),node(1,e))=bigk(node(2,e),node(1,e))+ke(2,1);
bigk(node(2,e),node(2,e))=bigk(node(2,e),node(2,e))+ke(2,2);
force(e)=force(e)+fe(1);
force(e+1)=force(e+1)+fe(2);
fprintf(\'global stiffness matix is :\ \');
bigk
fprintf(\'global force matix is :\ \');
force
% ***second problem****%
L=1; %length
numele=4; % number of elements (change as per requirement)
le=L/numele; %element length
numnod=numele+1; % number of nodes (special case for 1D problem)
x= 0:L/numele:L; % x-coordinates of nodes
node= [1:numele; 2:numele+1]; % node stores the nodes of all elements
area=[ones(1,numele)]; % area of each element
young=[ones(1,numele)]; % Young\'s modulus of each element
bigk=[zeros(numnod,numnod)]; % zero bigk matrix to prepare for assembly
%
for e=1:numele % loop over elements
length=x(node(2,e))-x(node(1,e)); % compute element length
c=young(e)*area(e)/length; % \"spring stiffness\" for each rod
ke=[c,-c;-c,c]; % compute element stiffness%
% now assemble ke into bigk
bigk(node(1,e),node(1,e))=bigk(node(1,e),node(1,e))+ke(1,1);
bigk(node(1,e),node(2,e))=bigk(node(1,e),node(2,e))+ke(1,2);
bigk(node(2,e),node(1,e))=bigk(node(2,e),node(1,e))+ke(2,1);
bigk(node(2,e),node(2,e))=bigk(node(2,e),node(2,e))+ke(2,2);
end
![IGNORE IF YOU DON\'T HAVE MATLAB Obtain the assembled global stiffness matrix [k] and the global force vector {f} by hand using 1D linear FEM elements for the c IGNORE IF YOU DON\'T HAVE MATLAB Obtain the assembled global stiffness matrix [k] and the global force vector {f} by hand using 1D linear FEM elements for the c](/WebImages/19/ignore-if-you-dont-have-matlab-obtain-the-assembled-global-s-1038968-1761539423-0.webp)
![IGNORE IF YOU DON\'T HAVE MATLAB Obtain the assembled global stiffness matrix [k] and the global force vector {f} by hand using 1D linear FEM elements for the c IGNORE IF YOU DON\'T HAVE MATLAB Obtain the assembled global stiffness matrix [k] and the global force vector {f} by hand using 1D linear FEM elements for the c](/WebImages/19/ignore-if-you-dont-have-matlab-obtain-the-assembled-global-s-1038968-1761539423-1.webp)