You are on page 1of 1

E=1;I=1;EI=E*I; numberElements=80; nodeCoordinates=linspace(0,1,numberElements+1)'; xx=nodeCoordinates;L=max(nodeCoordinates); numberNodes=size(nodeCoordinates,1); >> for i=1:numberElements; elementNodes(i,1)=i; elementNodes(i,2)=i+1; end >> % distributed load >>

P=-1; >> %for structure: >> GDof=2*numberNodes; >> U=zeros(GDof,1); >> %stiffness matrix and force vector >> [stiffness,force]=... formStiffnessBernoulliBeam(GDof,numberElements,... elementNodes,numberNodes,xx,EI,P); >> %Boundary conditions and solution >> %clamped-clamped >> %fixedNodeU=[1 2*numberElements+1]'; >> %fixedNodeV=[2 2*numberElements+2]'; >> %simply supported-simply supported >> fixedNodeU=[1 2*numberElements+1]'; fixedNodeV=[]'; >> %clamped at x=0 >> %fixNodeU=[1]'; fixnodeV=[2]'; >> prescribedDof=[fixedNodeU;fixedNodeV]; >> %solution >> displacements=solution(GDof,prescribedDof,stiffness,force); >> %output displaments/reactions >> outputDisplacementsReactions(displacements,stiffness,... GDof,prescribedDof) >> %drawing deform shape >> U=displacements(1:2:2*numberNodes); >> plot(nodeCoordinates,U,'.')

You might also like