code for fem -constrained bar
이전 댓글 표시
I was trying to write a code for a horizontal two step bar constrained at both ends to determine its deflection at the three nodes and reactionary forces at the ends.At node 2 an axial force of 2kN is applied.I am clueless how to go about writing the code.Everytime I run it an error pops up.Can somebody guide me
% static analysis
%material properties
E=[70e9,200e9];
%Geometry
L=700e-3;
A=[2400e-6,600e-6];
q0=0;
%Element mesh
ne=2; %no.of elements
nn=3; %no.of nodes
dof=1; %degrees of freedom per node
tdof=dof*nn; % total degree of freedom
le=[300e-3,400e-3]; %length of elements
% Initialization of Global Matrices
KG=zeros(tdof,tdof); %global stiffness matrix
FG = zeros(tdof,1); % global load vector
%assembly of global matrices
for i= 1:ne
Ke(i)=(E(i)*A(i)/le(i))*[1 -1;-1 1]; % element stiffness matrix
Fe=(q0*le(i)/2)*[1;1]; % element load vector for udl
for j=1:2
for k=1:2
KG(CONN(i,j),CONN(i,k))= KG(CONN(i,j),CONN(i,k))+Ke(i);
end
FG(CONN(i,j),1)= FG(CONN(i,j),1)+Fe(i,j);
end
end
CONN=[1 2;2 3];
KG(1,:)=0;
KG(:,1)=0;
KG(1,1)=1;
KG(3,:)=0;
KG(:,3)=0;
KG(3,3)=0;
FG(3,1)=0;
For m=[1,3];
KG(m,:)=0;
KG(:,m)=0;
KG(m,m)=1;
FG(m,1)=0;
End
UG=linsolve(KG,FG);
댓글 수: 6
darova
2020년 2월 25일
What does it mean?

Syed Haque
2020년 2월 25일
darova
2020년 2월 25일
This instruction doesn't work (somehow)
Did it work for you?
Syed Haque
2020년 2월 26일
darova
2020년 2월 26일
These two statements look familiar for me

What do you think?
Syed Haque
2020년 2월 26일
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Programming에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
