% Example: trussrun % ~~~~~~~~~~~~~~~~~ % This program performs static analysis of % plane truss structures using the stiffness % method. The truss elements are used to form % the global stiffness matrix of a structure. % Displacements, member forces and reaction % forces are obtained by solving the equations % which satisfy the prescribed boundary % conditions and applied nodal forces. % Data is defined in the declaration statements % below, where: % % For each element: % Emod - Modulus of elasticity % Area - cross-sectional area % inode - nodal number of i-end % jnode - nodal number of j-end % For each node: % x - x coordinate % y - y coordinate % The specified D.O.F. and applied nodal loads: % idu - nodal number of specified % x-displacement % u - specified x-displacement % idv - nodal number of specified % y-displacement % v - specified y-displacement % idfx - nodal number of applied load in % x-direction % fx - applied load in x-direction % idfy - nodal number of applied load in % y-direction % fy - applied load in y-direction % % User m functions required: % asmstf, elmstf, memfor, solve %---------------------------------------------- clear; Problem=1; if Problem == 1 %...Simply supported 7-bar, 5-node plane truss Emod =[3.e7 3.e7 3.e7 3.e7 3.e7 3.e7 3.e7]; Area =[ 10 10 10 10 10 10 10]; inode =[ 1 2 1 4 2 3 4]; jnode =[ 2 3 4 2 5 5 5]; x =[ 0 144 288 72 216]; y =[ 0 0 0 96 96]; idu =[1]; idfx=[4]; u =[0]; fx =[3000]; idv =[1 3]; idfy=[2 5]; v =[0 0]; fy =[-4000 -1000]; end %...Assemble the global stiffness matrix Stiff=asmstf(x,y,Area,Emod,inode,jnode); %...Displacement and reaction solutions [Disp,Reactions]= ... solve(Stiff,idu,u,idv,v,idfx,fx,idfy,fy); %...Member force solutions Mforces=memfor(Disp,x,y,Area,Emod,inode,jnode); fprintf( ... '\n\nAnalysis of Pin-Connected Truss'); fprintf( ... '\n-------------------------------'); fprintf('\n\nMember Information:'); fprintf('\n # E A '); fprintf(' i j'); fprintf('\n --- ------------ ------------'); fprintf(' ---- ----'); for i=1:length(Emod) fprintf('\n %4.0f %12.4e %12.5e', ... i,Emod(i),Area(i)); fprintf(' %4.0f %4.0f',inode(i),jnode(i)); end fprintf('\n\nNode list:'); fprintf('\n # x y'); fprintf('\n --- ------------ ------------'); for i=1:length(x) fprintf('\n %4.0f %12.5e %12.5e', ... i,x(i),y(i)); end fprintf('\n\nBoundary conditions:'); fprintf('\n # Condition Value'); fprintf('\n --- ------------ ------------'); for i=1:length(idu) fprintf('\n %4.0f u %12.5e', ... idu(i),u(i)); end for i=1:length(idv) fprintf('\n %4.0f v %12.5e', ... idv(i),v(i)); end for i=1:length(idfx) fprintf('\n %4.0f Fx %12.5e', ... idfx(i),fx(i)); end for i=1:length(idfy) fprintf('\n %4.0f Fy %12.5e', ... idfy(i),fy(i)); end fprintf('\n\nNodal Displacements:'); fprintf('\n # u v'); fprintf('\n --- ------------ ------------'); for i=1:2:length(Disp)-1 fprintf('\n %4.0f %12.5e %12.5e', ... fix(i/2)+1,Disp(i),Disp(i+1)); end fprintf('\n\nNodal Reactions:'); fprintf('\n # Fx Fy'); fprintf('\n --- ------------ ------------'); for i=1:2:length(Reactions)-1 fprintf('\n %4.0f %12.5e %12.5e', ... fix(i/2)+1,Reactions(i),Reactions(i+1)); end fprintf('\n');