0% found this document useful (0 votes)
26 views

Problem 1 Code: % FEA Truss Analysis

This document describes a finite element analysis (FEA) of a truss structure. It defines inputs for the number of nodes, cross-sectional areas, node coordinates, elastic modulus, and applied forces. Element stiffness matrices are calculated and assembled into a global stiffness matrix. The user provides a condensed stiffness matrix and the displacements are solved for by inverting and multiplying the matrix by applied forces. The solution displacements are displayed.

Uploaded by

Terry Beesoon
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views

Problem 1 Code: % FEA Truss Analysis

This document describes a finite element analysis (FEA) of a truss structure. It defines inputs for the number of nodes, cross-sectional areas, node coordinates, elastic modulus, and applied forces. Element stiffness matrices are calculated and assembled into a global stiffness matrix. The user provides a condensed stiffness matrix and the displacements are solved for by inverting and multiplying the matrix by applied forces. The solution displacements are displayed.

Uploaded by

Terry Beesoon
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Problem 1 Code

clc
clear
% FEA Truss Analysis
n = input('number of nodes n=');
A = input('Area Matrix A=');
X1 = input('elements nodal matrix X1=');
Y1 = input('elements nodal matrix Y1=');
X2 = input('elements nodal matrix X2=');
Y2 = input('elements nodal matrix Y2=');
E = input('Elastic Modulous matrix E=');
F = input('X and Y nodal force Row Matrix F=');
% Creation of element stiffness K
i=0;
while(1)
i = 1+i;
L(1,i) = sqrt((X2(1,i)-X1(1,i))^2+(Y2(1,i)-Y1(1,i))^2);
KA(1,i) = A(1,i)*E(1,i)/L(1,i);
C(1,i) = ((X2(1,i)-X1(1,i))/L(1,i));
S(1,i) = ((Y2(1,i)-Y1(1,i))/L(1,i));
CS(1,i) = C(1,i)*S(1,i);
C2(1,i) = C(1,i)^2;
S2(1,i) = S(1,i)^2;
if i>=n, break,end
end
for i=1:n
K11(i)=C2(1,i)*KA(1,i); K12(i)=CS(1,i)*KA(1,i);
K13(i)=-CS(1,i)*KA(1,i);K14(i)=-CS(1,i)*KA(1,i);
K22(i)=S2(1,i)*KA(1,i);K24(i)=-S2(1,i)*KA(1,i);
K21(i)=K12(i);K34(i)=K12(i);K43(i)=K12(i);
K33(i)=K11(i);K31(i)=K13(i);K44(i)=K22(i);
K42(i)=K24(i);K23(i)=K14(i);K32(i)=K14(i);
K41(i)=K14(i);
end
%Enter [S] Condensed MAtrix
%Ex: For 2 member truss with both ends hinged
%S=[K33(1)+K11(2) K34(1)+K12(2); K43(1)+K21(2) K44(1)+K22(2)]
S = input('enter condensed matrix S=');
u= inv(S)*F';
disp(u)

Problem 1 Command Window


number of nodes n=4
Area Matrix A=[6 6 6 6]
elements nodal matrix X1=[0 0 30 30]
elements nodal matrix Y1=[0 60 30 30]
elements nodal matrix X2=[0 30 0 30]
elements nodal matrix Y2=[60 30 0 0]
Elastic Modulous matrix E=[10e6 10e6 10e6 10e6]
X and Y nodal force Row Matrix F=[-4000 1000 0 0]
enter condensed matrix S=[K33(1)+K11(2) K34(1)+K12(2) K13(2) K14(2); K43(1)+K21(2) K44(1)+K22(2)
K23(2) K24(2); K31(2) K32(2) K33(2)+K11(3)+K11(4) K34(2)+K12(3)+K12(4); K41(2) K42(2)
K43(2)+K21(3)+K21(4) K44(2)+K22(3)+K22(4)]

Solution
0.0067
0.0059
-0.0063
-0.0002

You might also like