function stif=asmstf(x,y,Area,Emod,inode,jnode) % % stif=asmstf(x,y,Area,Emod,inode,jnode) % ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ % This function assembles the global stiffness % matrix for a plane truss structure. The % stiffness matrix has an order equal to twice % the number of nodes. % % x,y - global nodal coordinate vectors % Area - member area vector % Emod - modulus of elasticity vector % inode,jnode - indices of the member ends % % stif - global stiffness matrix % % User m functions called: elmstf %---------------------------------------------- numnod=length(x); numelm=length(Area); i=inode(:); j=jnode(:); stif=zeros(2*numnod); ij=[2*i-1,2*i,2*j-1,2*j]; %...Place the stiffness matrix for individual %...members at proper positions in the global %...matrix for k=1:numelm, kk=ij(k,:); stif(kk,kk)=stif(kk,kk)+ ... elmstf(x,y,Area(k),Emod(k),i(k),j(k)); end