资源描述:
《杆梁结构的有限元分析原理课件.ppt》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、functiony=LinearBarElementStiffness(E,A,L)%LinearBarElementStiffnessThisfunctionreturnstheelement%stiffnessmatrixforalinearbarwith%modulusofelasticityE,cross-sectional%areaA,andlengthL.Thesizeofthe%elementstiffnessmatrixis2x2.y=[E*A/L-E*A/L;-E*A/LE*A/L];fu
2、nctiony=LinearBarAssemble(K,k,i,j)%LinearBarAssembleThisfunctionassemblestheelementstiffness%matrixkofthelinearbarwithnodesiandj%intotheglobalstiffnessmatrixK.%Thisfunctionreturnstheglobalstiffness%matrixKaftertheelementstiffnessmatrix%kisassembled.K(i,i)=
3、K(i,i)+k(1,1);K(i,j)=K(i,j)+k(1,2);K(j,i)=K(j,i)+k(2,1);K(j,j)=K(j,j)+k(2,2);y=K;functiony=LinearBarElementForces(k,u)%LinearBarElementForcesThisfunctionreturnstheelementnodal%forcevectorgiventheelementstiffness%matrixkandtheelementnodaldisplacement%vector
4、u.y=k*u;functiony=LinearBarElementStresses(k,u,A)%LinearBarElementStressesThisfunctionreturnstheelementnodal%stressvectorgiventheelementstiffness%matrixk,theelementnodaldisplacement%vectoru,andthecross-sectionalareaA.y=k*u/A;num_element=2;%单元个数num_element_
5、node=2;%每个单元节点个数num_node=3;%节点总个数dof_node=1;%节点自由度%单元连通性表Ind=zeros(num_element,num_element_node);Ind(1,:)=[12];Ind(2,:)=[23];%节点坐标node=zeros(num_node,1);node(1)=0;node(2)=0.1;node(3)=0.2;%材料参数-弹性模量E=zeros(num_element,1);E(1)=2e7;E(2)=2e7;%单元几何参数-杆单元横截面面积A=
6、zeros(num_element,1);A(1)=2e-4;A(2)=1e-4;%杆单元长度L=zeros(num_element,1);forii=1:num_elementind1=Ind(ii,2);ind2=Ind(ii,1);L(ii)=abs(node(ind2)-node(ind1));end%边界条件bc_u_ind=[1];%加位移边界条件的自由度编号bc_u=[0];%位移边界条件bc_f_ind=[2,3];%加力边界条件的自由度编号bc_f=[0;10];%力边界条件K_total
7、=zeros(num_node*dof_node);%总刚度矩阵forii=1:num_element%第ii个单元刚度矩阵K_element=LinearBarElementStiffness(E(ii),A(ii),L(ii));%第ii个单元刚度矩阵加入总刚度矩阵K_total=LinearBarAssemble(K_total,K_element,Ind(ii,1),Ind(ii,2));end%加边界条件求解u=zeros(num_node*dof_node,1);u(bc_u_ind)=bc_u
8、;k1=K_total(bc_f_ind,bc_f_ind);k2=K_total(bc_f_ind,bc_u_ind);u(bc_f_ind)=k1(bc_f-k2*bc_u);%后处理f=zeros(num_element_node*dof_node,num_element);%单元节点力矢量forii=1:num_element%第ii个单元刚度矩阵K_element=LinearBarElementSt