code for fem -constrained bar
Mostra commenti meno recenti
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 Commenti
darova
il 25 Feb 2020
What does it mean?

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

What do you think?
Syed Haque
il 26 Feb 2020
Risposte (0)
Categorie
Scopri di più su Programming in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
