📄 vtb8_1
字号:
function VTB8_1% VTB8_1 [node,ncon,zero,force]=VTB8_1% Makes input file for VTB8_2.Mclchomehold offaxis('square')loc=input('Enter x and y location of node. (ie. [x y]) ');node(1,:)=loc;plot(node(:,1),node(:,2),'*b')for i=2:1000 loc=input('Enter x and y location of node (ie. [x y]) or 0 to end. '); if loc==0 & length(loc)==1 ,break,end node(i,:)=loc; length=max([max(node(:,1))-min(node(:,1)) max(node(:,2))-min(node(:,2))]); xl=(max(node(:,1))+min(node(:,1)))/2-.7*length; xh=(max(node(:,1))+min(node(:,1)))/2+.7*length; yl=(max(node(:,2))+min(node(:,2)))/2-.7*length; yh=(max(node(:,2))+min(node(:,2)))/2+.7*length; axis([xl xh yl yh]) plot(node(:,1),node(:,2),'*b') for j=1:i [labx,laby]=dc2sc(node(j,1),node(j,2)); labx=labx+.015; laby=laby+.015; nnum=num2str(j); text(labx,laby,nnum,'sc') endendhold onclcdisp('Do you have a pointing device such as a mouse or trackball? (y/n)')disp('(Arrow keys may be sufficient)')point=input(' ','s');%connecting nodes sectionclchome disp(' Pick nodes to connect with elements.')if point=='y' disp('(Use pointing device or arrow keys and return)') else disp('(Enter node numbers one at a time)')end pause(2)answer2='n';for i=1:1000 clc home if point=='y' [x1 y1]=ginput(1); dis=(node(:,1)-x1).^2+(node(:,2)-y1).^2; [dsq,nodenum1]=min(dis); else plot nodenum1=input('Enter node number 1: '); end plot(node(nodenum1,1),node(nodenum1,2),'*i') plot(node(nodenum1,1),node(nodenum1,2),'or') if point=='y' [x2 y2]=ginput(1); dis=(node(:,1)-x2).^2+(node(:,2)-y2).^2; [dsq,nodenum2]=min(dis); else nodenum2=input('Enter node number 2: '); end plot(node(nodenum2,1),node(nodenum2,2),'*i') plot(node(nodenum2,1),node(nodenum2,2),'or') plot([node(nodenum1,1) node(nodenum2,1)],[node(nodenum1,2) node(nodenum2,2)],'-b') plot(node(nodenum1,1),node(nodenum1,2),'oi') plot(node(nodenum1,1),node(nodenum1,2),'*b') plot(node(nodenum2,1),node(nodenum2,2),'oi') plot(node(nodenum2,1),node(nodenum2,2),'*b') clc home if i>1 answer2=input('Same properties as previous element? (y/n) ','s'); end if answer2=='n' clc E=input('Enter the modulus of elasticity of the member. '); %disp(' Enter the shear modulus of the member. ') G=input('Enter the shear modulus of the member.(zero for EB beam)'); I=input('Enter the moment of area of the member. '); A=input('Enter the cross sectional area of the member. '); Rho=input('Enter the density per unit length of the member. '); end ncon(i,:)=[nodenum1 nodenum2 E A I G Rho]; answer=input('Enter another element? (y/n) ','s'); if answer~='y',break,endend% adding concentrated masses and inertiasconm=[];for i=1:1000clchome if i==1 answer=input('Add concentrated masses and rotational inertias? (y/n) ','s'); end if i>1 answer=input('Add more concentrated masses and rotational inertias? (y/n) ','s'); end if answer~='y',break,end disp(' ') disp(' Pick node to add mass/rotational inertia to.') pause(2) if point=='y' [x1 y1]=ginput(1); dis=(node(:,1)-x1).^2+(node(:,2)-y1).^2; [dsq,nodenum]=min(dis); else plot nodenum=input('Enter node number: '); end plot(node(nodenum,1),node(nodenum,2),'*i') plot(node(nodenum,1),node(nodenum,2),'xr') answer=input('Add mass or rotational inertia?(m,i,n(one)) ','s'); massval=input('Enter magnitude of mass/inertia. '); conm(i,:)=[0 0 0]; conm(i,1)=nodenum; if answer=='m' conm(i,2)=massval; end if answer=='i' conm(i,3)=massval; end plot(node(nodenum,1),node(nodenum,2),'xi') plot(node(nodenum,1),node(nodenum,2),'*b')end% zeroing of displacementszero=[];ij=0;for i=1:1000clchome if i==1 answer=input('Add boundary conditions? (y/n) ','s'); end if i>1 answer=input('Zero another displacement? (y/n) ','s'); end if answer~='y',break,end disp(' ') disp(' Pick node to zero') pause(1.5) if point=='y' [x1 y1]=ginput(1); dis=(node(:,1)-x1).^2+(node(:,2)-y1).^2; [dsq,nodenum]=min(dis); else plot nodenum=input('Enter node number: '); end plot(node(nodenum,1),node(nodenum,2),'*i') plot(node(nodenum,1),node(nodenum,2),'xr') disp(' ') disp(' ') disp(' Zero which displacement(s)?(x,y,t(heta),n(one))') disp(' (ie xt for x and theta)'); answern=input(' ','s'); sanswern=size(answern);for ii=1:sanswern(2) ij=ij+1; answer=answern(ii); if answer=='x' plot(node(nodenum,1),node(nodenum,2),'xi') plot(node(nodenum,1),node(nodenum,2),'*b') zero(ij,:)=[nodenum 1]; end if answer=='y' plot(node(nodenum,1),node(nodenum,2),'xi') plot(node(nodenum,1),node(nodenum,2),'*b') zero(ij,:)=[nodenum 2]; end if answer=='t' plot(node(nodenum,1),node(nodenum,2),'xi') plot(node(nodenum,1),node(nodenum,2),'*b') zero(ij,:)=[nodenum 3]; end if answer=='n' plot(node(nodenum,1),node(nodenum,2),'xi') plot(node(nodenum,1),node(nodenum,2),'*b') end endendforce=[];% adding loadsfor i=1:1000clchome answer=input('Add loads? (y/n) ','s'); if answer~='y',break,end disp(' ') disp(' Pick node to load') pause(1.5) if point=='y' [x1 y1]=ginput(1); dis=(node(:,1)-x1).^2+(node(:,2)-y1).^2; [dsq,nodenum]=min(dis); else plot nodenum=input('Enter node number: '); end plot(node(nodenum,1),node(nodenum,2),'*i') plot(node(nodenum,1),node(nodenum,2),'xr') answer=input('Load which displacement?(x,y,t(heta),n(one)) ','s'); if answer=='x' loadval=input('Enter magnitude of load. '); force(i,:)=[nodenum 1 loadval]; end if answer=='y' loadval=input('Enter magnitude of load. '); force(i,:)=[nodenum 2 loadval]; end if answer=='theta' loadval=input('Enter magnitude of load. '); force(i,:)=[nodenum 3 loadval]; end answer=input('Load another node? (y/n) ','s'); if answer~='y',break,end plot(node(nodenum,1),node(nodenum,2),'xi') plot(node(nodenum,1),node(nodenum,2),'*b')endnode;ncon;zero;force;answer=input('Save configuration file (Else all will have been in vain)? (y/n) ','s');if answer=='y' filename=input('Enter name of configuration file. ','s'); eval(['save ',''filename'','.con',' node',' ncon',' zero',' force',' conm']); answer=input('Run analysis? (y/n) ','s'); if answer=='y' VTB8_2(filename); endend
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -