FEM-Course-Matlab/6.桁架结构matlab有限元编程/Truss3D/main_bar120_3D.m

44 lines
1.4 KiB
Matlab
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

clc,clear
tic
nodes=zeros(3,49); %创建节点
ele=zeros(120,5);%创建单元
l1=13883.89;l2=24085.55;l3=31775.91;
h1=3000;h2=5850.13;h3=7000;h4=0;
th=0:1/6:(11/6);
th=th.*pi;
nodes(:,1)=[0;0;h3];
Constr=zeros(12,4);
%节点坐标
for i=1:length(th)
nodes(:,i+1)=[l1*cos(th(i));l1*sin(th(i));h2];
nodes(:,12+2*i:13+2*i)=[l2*cos(th(i)),l2*cos(th(i)+pi/12);...
l2*sin(th(i)),l2*sin(th(i)+pi/12);h1,h1];
nodes(:,37+i)=[l3*cos(th(i));l3*sin(th(i));h4];
Constr(i,1)=37+i;%d定义约束
end
%单元信息: 单元编号单元节点1单元节点2
for i=1:length(th)
ele(i,2:3)=[1,i+1]; %顺时针对单元编号
if i==1
ele(10+3*i:12+3*i,2:3)=[i+1,37;i+1,12+2*i;i+1,13+2*i]; %13-48
ele(46+3*i:48+3*i,2:3)=[i+37,37;i+37,12+2*i;i+37,13+2*i]; %49-84
ele(84+i,2:3)=[13,i+1]; %85-96
ele(95+2*i:96+2*i,2:3)=[37,14;12+2*i,13+2*i]; %97-120
else
ele(10+3*i:12+3*i,2:3)=[i+1,11+2*i;i+1,12+2*i;i+1,13+2*i];
ele(46+3*i:48+3*i,2:3)=[i+37,11+2*i;i+37,12+2*i;i+37,13+2*i];
ele(84+i,2:3)=[i,i+1];
ele(95+2*i:96+2*i,2:3)=[11+2*i,12+2*i;12+2*i,13+2*i];
end
end
for i=1:length(ele(:,1))
ele(i,1)=i;
end
A=3;E=2.1E005; %各单元截面面积和材料弹性模量
ele(:,4:5)=ones(120,2)*[A 0;0 E]; %单元信息: 截面积,弹性模量
Load=[1 0 0 -200]; %载荷信息单元编号x方向力y方向力z方向力
x=nodes(1,:);
y=nodes(2,:);
z=nodes(3,:);
[U, Strain, Stress, AxialForce]=Truss3DStaticsFEA(x,y,z,ele,Load,Constr,20)
toc