剪力图和弯矩图教程
- 格式:ppt
- 大小:394.00 KB
- 文档页数:14
绘制工程力学剪力图和弯矩图的简易方法-力学论文-物理论文——文章均为WORD文档,下载后可直接编辑使用亦可打印——0引言工程力学中,直梁的弯曲变形是杆件受力变形的基本形式之一,在对梁进行强度和刚度计算时,通常要画出剪力图和弯矩图,以便清楚地看出梁的各个截面上剪力和弯矩的大小、正负以及最大值所在截面的位置[1].但不少学生在学习剪力图和弯矩图绘制知识点时,直呼太难,根本不知从何下手。
因此,总结出一套行之有效的简易绘制剪力图和弯矩图的方法,显得越来越重要。
下面就结合作者实际教学经验,提出解决此类问题的简易方法。
1绘制剪力图和弯矩图的简易方法绘制剪力图和弯矩图时,应严格遵循下列基本步骤:①画梁的受力图,求约束力求出梁上所有约束部位的约束力是至关重要的第一步,这一步如果出现问题,后续步骤基本进行不了,关于求约束力的方法,在画好受力分析图后列平衡方程式即可求得。
②画剪力图。
画剪力图时,应牢记下面几句话:集中力作用处,剪力图有突变,突变幅值等于集中力的大小,突变的方向与力的方向同向;集中力偶作用处,剪力图无变化;均布载荷作用的梁段上,剪力图为一条斜直线;无外力作用的梁段上,剪力图为水平的直线。
对于剪力图为斜直线,只需确定直线的两个端点所对应的剪力值即可确定该直线,要求两个端点所对应的剪力值,采用某截面上的剪力值等于截面左边梁上所有外力的代数和,外力向上,则剪力为正,反之为负的方法。
③画弯矩图画弯矩图时,也须牢记以下几句话:集中力作用处,弯矩图有折点;集中力偶作用处,弯矩图有突变,突变幅值等于力偶矩的大小,力偶方向若为顺时针,则弯矩向上突变,反之向下突变;均布载荷作用的梁段,弯矩图为二次曲线,曲线开口方向与均布载荷同向,在剪力为零的截面,弯矩有极值;无外力作用的梁段,弯矩为直线。
对于弯矩为二次曲线的,只需取曲线上三个特殊的点,求出该点所对应截面的弯矩值即可确定该曲线,而求某截面上弯矩值,采用某截面上的弯矩值等于截面左边梁上所有外力矩的代数和,外力矩为顺时针的,弯矩为正,反之为负的方法。
简捷法绘制剪力图和弯矩图1 引言:在《建筑力学》中,梁的弯曲变形的教学最终目标是让学生掌握构件的强度和刚度计算中所必备的理论基础与计算方法,从而解决强度和刚度计算中的强度及刚度校核、设计截面尺寸、确定许可荷载这三类问题。
在以上三类问题的计算中,需要绘制剪力图和弯矩图确定危险截面。
而这部分内容计算量大、过程繁琐,给教学及学生掌握这部分内容带来了很大的难度。
因此找出在两图绘制中的简捷绘图方法是很有必要的。
2 传统绘制剪力图和弯矩圈的方法2.1根据梁的受力情况,计算约束反力可根据已知条件,包括受力情况及约束类型,用静力平衡方程进行计算,对学生来说能较容易解决。
2.2对梁分段,列出各段的剪力方程和弯矩方程分段时须先找到分界点,把每两个界点之间的部分作为一段。
一般把梁上的下列各点作为分界点:集中力作用处(包括主动力与约束反力)、集中力偶作用处及均布载荷的起止点。
接下来需列出每一段的剪力方程和弯矩方程,这个过程是比较繁琐的,每段列两个方程,且须确定各分段函数的定义域。
2.3确定各界点的剪力值和弯矩值根据各段的剪力方程与弯矩方程,计算各界点截面上的剪力值和弯矩值。
这个过程也较复杂,特别对于梁中段的界点,往往要分别计算其左侧及右侧截面上的剪力值和弯矩值。
2.4画剪力图与弯矩图根据各段的剪力方程、弯矩方程以及各界点截面上的剪力值、弯矩值绘制出剪力图(Q图)和弯矩图(M图)3 快速绘制剪力图与弯矩图的方法这种方法就是根据各种荷载的剪力图和弯矩图的规律,不需要列出剪力方程与弯矩方程而迅速绘制出剪力图与弯矩图,方法规律如下:3.1梁上没有荷载作用的梁段上。
剪力图为水平直线(斜率为0),弯矩图为倾斜直线。
当剪力为正号时弯矩图从左到右斜向上,当剪力为负号时弯矩图从左到右斜向下。
3.2有均布荷载作用的梁段上,剪力图为倾斜直线,弯矩图为抛物线。
当均布荷载指向下时剪力图从左到右向下倾斜,弯矩图为开口向下的抛物线,当均布荷载指向上时剪力图从左到右向上倾斜,弯矩图为开口向上的抛物线。
ANSYS绘制弯矩、剪力、轴力图命令流完全教程1.绘制弯矩图建立弯矩单元表。
例如梁单元i节点单元表名称为imom,j节点单元表名称为jmom,ETABLE,NI,SMISC,1 !单元I点轴力ETABLE,NJ,SMISC,7 !单元J点轴力ETABLE,QI,SMISC,2 !单元I点剪力ETABLE,QJ,SMISC,8 !单元J点剪力ETABLE,MI,SMISC,6 !单元I点弯矩ETABLE,MJ,SMISC,12 !单元J点弯矩plls,MI,MJ2.标注弯矩图PLOTCTRLS>>NUMBERING>>SVAL ON即可在画出弯矩图的同时在图上标出弯矩值的大小3.调整弯矩图如果弯矩图方向错误,则绘制弯矩图命令为plls,imom,jmom,-1同一个节点处两边的单元内力有细微差别,导致内力数字标注出现重影。
观察上面整体轴力图也可以发现,一段一段的,好像马赛克,其实上面整体弯矩图也是,不过不是很明显罢了。
这是EULER-BEONOULI梁理论以及ANSYS输出定义造成的(详细原因就不展开了,看看梁理论的书和ANSYS的说明吧)。
为了修正重影和节点两边内力值不一样的问题,遍制了宏文件ITFAVG.MAC命令文件内容如下:!---------------------------------------------------------------------!宏:ITFAVG.MAC(INTERNAL FORCE AVERAGE MACRO)!获取线性单元内力,并对单元边界处的内力进行平衡!输入信息!内力类型:MFORX,MFORY,MFORZ,MMOMX,MMOMY,MMOMZ*ASK,ITFTYPE,'PLEASE INPUT THE TYPE OF INTERNAL FORCE','MMOMY'!需处理的单元包*ASK,EASSEMBLY,'PLEASE INPUT THE COMPONENT NAME OF ELEMENTS TO BE PROCESSED!','EOUTER'!需处理的节点包*ASK,NASSEMBLY,'PLEASE INPUT THE COMPONENT NAME OF NODE TO BE PROCESSED!','NOUTER'!无需处理的节点包*ASK,UNASSEMBLY,'PLEASE INPUT THE COMPONENTNAME OF THE UNCHANGED NODE!(NONE IF THERE'S NO SUCH COMPONENT)','NONE'/POST1!输入信息:内力类型,欲处理单元的集合,欲处理节点的集合!ITFTYPE='MMOMY'!EASSEMBLY='EOUTER'!NASSEMBLY='NOUTER'!按内力类型确定ANSYS输出信息SMISC的编号*IF,ITFTYPE,EQ,'MFORX',THENITFINUM=1ITFJNUM=7*ELSEIF,ITFTYPE,EQ,'MFORY',THENITFINUM=2ITFJNUM=8*ELSEIF,ITFTYPE,EQ,'MFORZ',THENITFINUM=3ITFJNUM=9*ELSEIF,ITFTYPE,EQ,'MMOMX',THENITFINUM=4ITFJNUM=10*ELSEIF,ITFTYPE,EQ,'MMOMY',THENITFINUM=5ITFJNUM=11*ELSEIF,ITFTYPE,EQ,'MMOMZ',THENITFINUM=6ITFJNUM=12*ELSE*ENDIF!对不需平均的节点进行处理*IF,UNASSEMBLY,NE,'NONE',THEN!选出不进行处理的节点包并获取不进行处理节点的数目CMSEL,S,UNASSEMBLY*GET,UNNODNUM,NODE,0,COUNT!定义长度为UNNODNUM的数组(UNNOD),以存放选中单元的单元编号*DIM,UNNOD,ARRAY,UNNODNUM!将选中单元的编号按顺序存入数组UNNOD*DO,I,0,UNNODNUM-1,1UNNOD(I+1)=NDNEXT(I)*ENDDO*ELSEUNNODNUM=0*ENDIF!选出所需的单元和节点包CMSEL,S,EASSEMBLYCMSEL,S,NASSEMBLY!获得当前选中单元总数(存入变量SELELENUM)*GET,SELELENUM,ELEM,0,COUNT!定义长度为SELELENUM的数组(ELENUM),以存放选中单元的单元编号*DIM,ELENUM,ARRAY,SELELENUM!将选中单元的编号按顺序存入数组ELENUM*DO,I,0,SELELENUM-1,1ELENUM(I+1)=ELNEXT(I)*ENDDO!获得当前选中节点总数(存入变量SELNODNUM)*GET,SELNODNUM,NODE,0,COUNT!定义长度为SELNODNUM的数组(NODNUM),以存放选中单元的单元编号*DIM,NODNUM,ARRAY,SELNODNUM!将选中单元的编号按顺序存入数组NODNUM*DO,I,0,SELNODNUM-1,1NODNUM(I+1)=NDNEXT(I)*ENDDO!定义所需的线性单元内力ETABLE,节点I的内力存入数组ITNFI,!节点J的内力存入数组ITNFJETABLE,ITNFI,SMISC,ITFINUMETABLE,ITNFJ,SMISC,ITFJNUM!定义所需的结果数组,并将其置零ETABLE,ITNFINEO,SMISC,5SADD,ITNFINEO,ITNFI,,1ETABLE,ITNFJNEO,SMISC,11SADD,ITNFJNEO,ITNFJ,,1*DO,K,1,SELNODNUM,1!处理不需平均的节点INDEX=0*IF,UNNODNUM,GE,1,THEN*DO,J,1,UNNODNUM*IF,NODNUM(K),EQ,UNNOD(J),THENINDEX=1*ELSE*ENDIF*ENDDO*ELSE*ENDIF*DO,J,1,SELELENUM,1!选出和节点K相连的线性单元中,I节点(对线性单元而言)为节点K的单元编号*IF,NELEM(ELENUM(J),1),EQ,NODNUM(K),THENELEI=ELENUM(J)*EXIT*ELSE*ENDIF*ENDDO*DO,J,1,SELELENUM,1!选出和节点K相连的线性单元中,J节点(对线性单元而言)为节点K的单元编号*IF,NELEM(ELENUM(J),2),EQ,NODNUM(K),THENELEJ=ELENUM(J)*EXIT*ELSE*ENDIF*ENDDO*IF,INDEX,EQ,0,THEN*IF,ELEJ,NE,0,THEN !有可能出现ELEJ为0的情况!取出I节点为节点K的单元的I节点端的内力放入参数ETELEI *GET,ETELEI,ELEM,ELEI,ETAB,ITNFI!取出J节点为节点K的单元的J节点端的内力放入参数ETELEJ *GET,ETELEJ,ELEM,ELEJ,ETAB,ITNFJ!平均节点K的单元的I节点端的内力和节点K的单元的J节点端的内力ETAVE=(ETELEI+ETELEJ)/2!将平均后的内力存入结果数组中DETAB,ELEI,ITNFINEO,ETAVEDETAB,ELEJ,ITNFJNEO,ETAVE*ELSE*ENDIF*ELSE*ENDIF*ENDDO/UDOC,1,LOGO,OFFPLLS,ITNFINEO,ITNFJNEO!END OF ITFAVG.MAC(2)对体和面来说,ANSYS默认的结果输出格式是云图格式,而这种彩色云图打印为黑白图像时对比很不明显,无法表达清楚,对于发表文章非常不便。
作为一名土木工程师,在实际工作中,有时候要对软件(midas、sap2000、pkpm 的计算结果有个判断)就要对结构的弯矩和剪力图有个大概的判断。
下面总结各种结构弯矩图的绘制及图例:
一、方法步骤
1、确定支反力的大小和方向(一般情况心算即可计算出支反力)
●悬臂式刚架不必先求支反力;
●简支式刚架取整体为分离体求反力;
●求三铰式刚架的水平反力以中间铰C的某一边为分离体;
●对于主从结构的复杂式刚架,注意“先从后主”的计算顺序;
●对于复杂的组合结构,注意寻找求出支反力的突破口。
2、对于悬臂式刚架,从自由端开始,按照分段叠加法,逐段求作M图(M图画在受拉一侧);对于其它形式的刚架,从支座端开始,按照分段叠加法,逐段求作M图(M图画在受拉一侧)。
二、观察检验M图的正确性
1、观察各个关键点和梁段的M图特点是否相符
●铰心的弯矩一定为零;
●集中力偶作用点的弯矩有突变,突变值与集中力偶相等;
●集中力作用点的弯矩有折角;
●均布荷载作用段的M图是抛物线,其凹凸方向与荷载方向要符合“弓箭法则”;
2、结构中的链杆(二力杆)没有弯矩;
3、结构中所有结点的杆端弯矩必须符合平衡特点。
100张结构弯矩图例如下:。
材料力学剪力图弯矩图绘制(有详细的程序)说明:输入变量:分段数组x分段点一般在集中力,集中力偶作用出和分布载荷的起末端。
载荷数组MPQ若梁上的外载荷总数为PN,则用PN行四列的数组MPQ储存载荷,数组MPQ第一列代表载荷的类型:1为集中力偶,2为集中力,3为分布载荷,第二列代表载荷的大小,第三列代表集中力,集中力偶或者分布载荷左端与简支梁左端的距离,第四列代表均匀载荷右端与简支梁左端的距离,当载荷为集中力或者集中力偶时,第四列为0.符号规定集中力和均匀载荷向下为正,向上为负,集中力偶顺时针为正,逆时针为负。
输出变量:内力数组XQM如果梁被分为NN-1段,则内力数组XQM为NN行,三列的数组,第一列代表梁的横截面的位置,第二列代表剪力,第三列代表弯矩。
剪力极值及位置QDXQDX是一个二行二列的数组,第一列代表极值所在的位置,第二列代表极值弯矩极值及位置MDXMDX是一个二行二列的数组,第一列代表极值所在的位置,第二列代表极值1.子程序1.1集中力偶对弯矩贡献的子函数QMM1.2集中力对剪力和弯矩贡献的子函数QMP1.3分布载荷对剪力和弯矩贡献的子函数QMQ1.4求剪力和弯矩极值的子函数MAX_MIN1.5绘制剪力图和弯矩图的子函数TU_QM2.计算分析程序2.1简支梁QMDJ2.2左端固定悬臂梁QMDXZ2.3右端固定悬臂梁QMDXY2.4左端外伸梁QMDWZ2.5右端外伸梁QMDWY2.6两端外伸梁QMDWL1.子程序1.1集中力偶对弯矩贡献的子函数QMMfunction MM=QMM(n,x1,a,M,MM)for j=1:nif x1(j)==an1=j;endendMM(n1:n)=MM(n1:n)+M;1.2集中力对剪力和弯矩贡献的子函数QMP function [QQ,MM]=QMP(n,x1,b,P,QQ,MM)for j=1:nif x1(j)==b;n1=j;endendQQ(n1:n)=QQ(n1:n)-P;MM(n1:n)=MM(n1:n)-P*(x1(n1:n)-b);1.3分布载荷对剪力和弯矩贡献的子函数QMQ function [QQ,MM]=QMQ(n,x1,c,d,q,QQ,MM)for j=1:nif x1(j)>cQQ(j)=QQ(j)-q*(x1(j)-c);MM(j)=MM(j)-0.5*q*(x1(j)-c)^2;endif x1(j)>dQQ(j)=QQ(j)+q*(x1(j)-d);MM(j)=MM(j)+0.5*q*(x1(j)-d)^2;endend1.4求剪力和弯矩极值的子函数MAX_MINfunction [QDX,MDX,XQM]=MAX_MIN(x1,QQ,MM) XQM=[x1',QQ',MM'];[Qmax,i]=max(QQ);Q1=[Qmax,x1(i)];[Qmin,i]=min(QQ);Q2=[Qmin,x1(i)];[Mmax,i]=max(MM);M1=[Mmax,x1(i)];[Mmin,i]=min(MM);M2=[Mmin,x1(i)];disp('剪力极值及位置')QDX=[Q1;Q2]disp('弯矩极值及位置')MDX=[M1;M2]t1=findobj(0,'Tag','text31');str=num2str(Q1(1));set(t1,'String',str);t2=findobj(0,'Tag','text39');str=num2str(Q1(2));set(t2,'String',str);t3=findobj(0,'Tag','text32');str=num2str(Q2(1));set(t3,'String',str);t4=findobj(0,'Tag','text40');str=num2str(Q2(2));set(t4,'String',str);m1=findobj(0,'Tag','text33');str=num2str(M1(1));set(m1,'String',str);m2=findobj(0,'Tag','text41');str=num2str(M1(2));set(m2,'String',str);m3=findobj(0,'Tag','text34');str=num2str(M2(1));set(m3,'String',str);m4=findobj(0,'Tag','text42');str=num2str(M2(2));set(m4,'String',str);1.5绘制剪力图和弯矩图的子函数TU_QM function TU_QM(x1,QQ,MM)h1=findobj(0,'Tag','axes1');axes(h1);plot(x1,QQ);grid;title('剪力图');h2=findobj(0,'Tag','axes2');axes(h2);plot(x1,MM);grid;title('弯矩图');2.计算分析程序2.1简支梁QMDJfunction XQM=QMDJ(x,MPQ)[n,m]=size(x);L=x(m);x1=[];for i=1:m-1x1=[x1,linspace(x(i),x(i+1),50)];endMM=zeros(size(x1));QQ=zeros(size(x1));[m,t]=size(MPQ);[t,n]=size(x1);for i=1:mswitch MPQ(i,1)case 1M=MPQ(i,2);a=MPQ(i,3);RA=-M/L;QQ=QQ+RA;MM=MM+RA*x1;if a>0 & a<LMM=QMM(n,x1,a,M,MM);endif a==0MM=MM+M;endcase 2P=MPQ(i,2);b=MPQ(i,3);RA=(L-b)*P/L;if b>0 & b<LQQ=QQ+RA;MM=MM+RA*x1;[QQ,MM]=QMP(n,x1,b,P,QQ,MM);endcase 3q=MPQ(i,2);c=MPQ(i,3);d=MPQ(i,4);RA=(L-0.5*(c+d))*q*(d-c)/L;QQ=QQ+RA;MM=MM+RA*x1+MA;[QQ,MM]=QMQ(n,x1,c,d,q,QQ,MM);endend[QDX,MDX,XQM]=MAX_MIN(x1,QQ,MM);TU_QM(x1,QQ,MM);disp('梁的有限元分析结果')disp('位置-----------剪力----------弯矩')2.2左端固定悬臂梁QMDXZfunction XQM=QMDXZ(x,MPQ)[n,m]=size(x);L=x(m);x1=[];for i=1:m-1x1=[x1,linspace(x(i),x(i+1),50)];endMM=zeros(size(x1));QQ=zeros(size(x1));[PN,t]=size(MPQ);[t,n]=size(x1);for i=1:PNswitch MPQ(i,1)case 1M=MPQ(i,2);a=MPQ(i,3);if a>0 & a<LMM=MM-M;MM=QMM(n,x1,a,M,MM);endif a==LMM=MM-M;endcase 2P=MPQ(i,2);b=MPQ(i,3);RA=P;MA=-P*b;QQ=QQ+RA;MM=MM+RA*x1+MA;if b>0 & b<L[QQ,MM]=QMP(n,x1,b,P,QQ,MM);endcase 3q=MPQ(i,2);c=MPQ(i,3);d=MPQ(i,4);RA=q*(d-c);MA=-0.5*q*(d-c)*(d+c);QQ=QQ+RA;MM=MM+RA*x1+MA;[QQ,MM]=QMQ(n,x1,c,d,q,QQ,MM);endend[QDX,MDX,XQM]=MAX_MIN(x1,QQ,MM);TU_QM(x1,QQ,MM);disp('梁的有限元分析结果')disp('位置-----------剪力----------弯矩')2.3右端固定悬臂梁QMDXYfunction XQM=QMDXY(x,MPQ)[n,m]=size(x);L=x(m);x1=[];for i=1:m-1x1=[x1,linspace(x(i),x(i+1),50)];endMM=zeros(size(x1));QQ=zeros(size(x1));[PN,t]=size(MPQ);[t,n]=size(x1);for i=1:PNswitch MPQ(i,1)case 1M=MPQ(i,2);a=MPQ(i,3);if a==0MM=MM+M;endif a>0 & a<LMM=QMM(n,x1,a,M,MM);endcase 2P=MPQ(i,2);b=MPQ(i,3);if b==0QQ=QQ-PMM=MM-P*x1;endif b>0 & b<L[QQ,MM]=QMP(n,x1,b,P,QQ,MM);endcase 3q=MPQ(i,2);c=MPQ(i,3);d=MPQ(i,4);[QQ,MM]=QMQ(n,x1,c,d,q,QQ,MM);endend[QDX,MDX,XQM]=MAX_MIN(x1,QQ,MM);TU_QM(x1,QQ,MM);disp('梁的有限元分析结果')disp('位置-----------剪力----------弯矩')2.4左端外伸梁QMDWZfunction XQM=QMDWZ(x,L1,MPQ)[n,m]=size(x);L=x(m);x1=[];for i=1:m-1x1=[x1,linspace(x(i),x(i+1),50)];endMM=zeros(size(x1));QQ=zeros(size(x1));[PN,t]=size(MPQ);[t,n]=size(x1);for i=1:PNswitch MPQ(i,1)case 1M=MPQ(i,2);a=MPQ(i,3);if a>0 & a<LMM=QMM(n,x1,a,M,MM);endif a==0MM=MM+M;endcase 2P=MPQ(i,2);b=MPQ(i,3);RA=P*(L-b)/(L-L1);[QQ,MM]=QMP(n,x1,L1,-RA,QQ,MM);if b>0 & b<L[QQ,MM]=QMP(n,x1,b,P,QQ,MM);endif b==0QQ=QQ-P;MM=MM-P*x1;endcase 3q=MPQ(i,2);c=MPQ(i,3);d=MPQ(i,4);b=(c+d)*0.5;P=(d-c)*q;RA=P*(L-b)/(L-L1);[QQ,MM]=QMP(n,x1,L1,-RA,QQ,MM);[QQ,MM]=QMQ(n,x1,c,d,q,QQ,MM);endend[QDX,MDX,XQM]=MAX_MIN(x1,QQ,MM);TU_QM(x1,QQ,MM);disp('梁的有限元分析结果')disp('位置-----------剪力----------弯矩')2.5右端外伸梁QMDWYfunction XQM=QMDWY(x,L1,MPQ)[n,m]=size(x);L=x(m);x1=[];for i=1:m-1x1=[x1,linspace(x(i),x(i+1),50)];endMM=zeros(size(x1));QQ=zeros(size(x1));[PN,t]=size(MPQ);[t,n]=size(x1);for i=1:PNswitch MPQ(i,1)case 1M=MPQ(i,2);a=MPQ(i,3);RA=-M/L1;RB=-RA;QQ=QQ+RA;MM=MM+x1*RA;if a>0 & a<LMM=QMM(n,x1,a,M,MM);endif a==0MM=MM+M;endcase 2P=MPQ(i,2);b=MPQ(i,3);RA=P*(L1-b)/L1;RB=P*b/L1;QQ=QQ+RA;MM=MM+x1*RA;[QQ,MM]=QMP(n,x1,L1,-RB,QQ,MM);if b>0 & b<L[QQ,MM]=QMP(n,x1,b,P,QQ,MM);endif b==0QQ=QQ-P;MM=MM-P*x1;endcase 3q=MPQ(i,2);c=MPQ(i,3);d=MPQ(i,4);b=(c+d)*0.5;P=(d-c)*q;RA=P*(L1-b)/L1;RB=P*b/L1;QQ=QQ+RA;MM=MM+x1*RA;[QQ,MM]=QMP(n,x1,L1,-RB,QQ,MM);[QQ,MM]=QMQ(n,x1,c,d,q,QQ,MM);endend[QDX,MDX,XQM]=MAX_MIN(x1,QQ,MM);TU_QM(x1,QQ,MM);disp('梁的有限元分析结果')disp('位置-----------剪力----------弯矩')2.6两端外伸梁QMDWLfunction XQM=QMDWL(x,L1,L2,MPQ)[n,m]=size(x);L=x(m);x1=[];for i=1:m-1x1=[x1,linspace(x(i),x(i+1),50)];endMM=zeros(size(x1));QQ=zeros(size(x1));[PN,t]=size(MPQ);[t,n]=size(x1);for i=1:PNswitch MPQ(i,1)case 1M=MPQ(i,2);a=MPQ(i,3);RA=-M/(L2-L1);RB=-RA;if a>0 & a<LMM=QMM(n,x1,a,M,MM);endif a==0MM=MM+M;endcase 2P=MPQ(i,2);b=MPQ(i,3);LL=L2-L1;bb=b-L1;RA=P*(LL-bb)/LL;RB=P*bb/LL;[QQ,MM]=QMP(n,x1,L1,-RA,QQ,MM);[QQ,MM]=QMP(n,x1,L2,-RB,QQ,MM);if b>0 & b<L[QQ,MM]=QMP(n,x1,b,P,QQ,MM);endif b==0QQ=QQ-P;MM=MM-P*x1;endcase 3q=MPQ(i,2);c=MPQ(i,3);d=MPQ(i,4);b=(c+d)*0.5;P=(d-c)*q;LL=L2-L1;bb=b-L1;RA=P*(LL-bb)/LL;RB=P*bb/LL;[QQ,MM]=QMP(n,x1,L1,-RA,QQ,MM);[QQ,MM]=QMP(n,x1,L2,-RB,QQ,MM);[QQ,MM]=QMQ(n,x1,c,d,q,QQ,MM);endend[QDX,MDX,XQM]=MAX_MIN(x1,QQ,MM);TU_QM(x1,QQ,MM);disp('梁的有限元分析结果')disp('位置-----------剪力----------弯矩')untitled.mfunction varargout = untitled(varargin)% UNTITLED M-file for untitled.fig% UNTITLED, by itself, creates a new UNTITLED or raises the existing% singleton*.%% H = UNTITLED returns the handle to a new UNTITLED or the handle to% the existing singleton*.%% UNTITLED('CALLBACK',hObject,eventData,handles,...) calls the local% function named CALLBACK in UNTITLED.M with the given input arguments. %% UNTITLED('Property','Value',...) creates a new UNTITLED or raises the% existing singleton*. Starting from the left, property value pairs are% applied to the GUI before untitled_OpeningFunction gets called. An% unrecognized property name or invalid value makes property application% stop. All inputs are passed to untitled_OpeningFcn via varargin.%% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one% instance to run (singleton)".%% See also: GUIDE, GUIDA TA, GUIHANDLES% Edit the above text to modify the response to help untitled% Last Modified by GUIDE v2.5 03-Jun-2008 23:12:06% Begin initialization code - DO NOT EDITgui_Singleton = 1;gui_State = struct('gui_Name', mfilename, ...'gui_Singleton', gui_Singleton, ...'gui_OpeningFcn', @untitled_OpeningFcn, ...'gui_OutputFcn', @untitled_OutputFcn, ...'gui_LayoutFcn', [] , ...'gui_Callback', []);if nargin && ischar(varargin{1})gui_State.gui_Callback = str2func(varargin{1});endif nargout[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); elsegui_mainfcn(gui_State, varargin{:});end% End initialization code - DO NOT EDIT% --- Executes just before untitled is made visible.function untitled_OpeningFcn(hObject, eventdata, handles, varargin) % This function has no output args, see OutputFcn.% hObject handle to figure% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDA TA) % varargin command line arguments to untitled (see V ARARGIN)% Choose default command line output for untitledhandles.output = hObject;% Update handles structureguidata(hObject, handles);% UIWAIT makes untitled wait for user response (see UIRESUME) % uiwait(handles.figure1);% --- Outputs from this function are returned to the command line. function varargout = untitled_OutputFcn(hObject, eventdata, handles) % varargout cell array for returning output args (see V ARARGOUT); % hObject handle to figure% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDA TA)% Get default command line output from handles structure varargout{1} = handles.output;function edit2_Callback(hObject, eventdata, handles)% hObject handle to edit2 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDA TA)% Hints: get(hObject,'String') returns contents of edit2 as text% str2double(get(hObject,'String')) returns contents of edit2 as a double% --- Executes during object creation, after setting all properties.function edit2_CreateFcn(hObject, eventdata, handles)% hObject handle to edit2 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white');endfunction edit3_Callback(hObject, eventdata, handles)% hObject handle to edit3 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDA TA)% Hints: get(hObject,'String') returns contents of edit3 as text% str2double(get(hObject,'String')) returns contents of edit3 as a double% --- Executes during object creation, after setting all properties.function edit3_CreateFcn(hObject, eventdata, handles)% hObject handle to edit3 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white');endfunction edit4_Callback(hObject, eventdata, handles)% hObject handle to edit4 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDA TA)% Hints: get(hObject,'String') returns contents of edit4 as text% str2double(get(hObject,'String')) returns contents of edit4 as a double% --- Executes during object creation, after setting all properties.function edit4_CreateFcn(hObject, eventdata, handles)% hObject handle to edit4 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white');end% --- Executes on selection change in popupmenu1.function popupmenu1_Callback(hObject, eventdata, handles)% hObject handle to popupmenu1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: contents = get(hObject,'String') returns popupmenu1 contents as cell array% contents{get(hObject,'Value')} returns selected item from popupmenu1% --- Executes during object creation, after setting all properties.function popupmenu1_CreateFcn(hObject, eventdata, handles)% hObject handle to popupmenu1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: popupmenu controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white');end% --- Executes on button press in pushbutton3.function pushbutton3_Callback(hObject, eventdata, handles)% hObject handle to pushbutton3 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDA TA)x=str2num(get(handles.edit2,'string'));MPQ=str2num(get(handles.edit3,'string'));L=str2num(get(handles.edit4,'string'));L1=L(1);L2=L(2);val=get(handles.popupmenu1,'Value');str=get(handles.popupmenu1,'String');switch str{val}case '简支梁'QMDJ(x,MPQ)case '左端固定悬臂梁'QMDXZ(x,MPQ)case '右端固定悬臂梁'QMDXY(x,MPQ)case '左端外伸梁'QMDWZ(x,L1,MPQ)case '右端外伸梁'QMDWY(x,L1,MPQ)case '两端外伸梁'QMDWL(x,L1,L2,MPQ)end% --- Executes on button press in pushbutton4.function pushbutton4_Callback(hObject, eventdata, handles)% hObject handle to pushbutton4 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) close all% --- Executes on key press over popupmenu1 with no controls selected. function popupmenu1_KeyPressFcn(hObject, eventdata, handles)% hObject handle to popupmenu1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDA TA)。
材料力学剪力图弯矩图绘制(有详细的程序)说明:输入变量:分段数组x分段点一般在集中力,集中力偶作用出和分布载荷的起末端。
载荷数组MPQ若梁上的外载荷总数为PN,则用PN行四列的数组MPQ储存载荷,数组MPQ第一列代表载荷的类型:1为集中力偶,2为集中力,3为分布载荷,第二列代表载荷的大小,第三列代表集中力,集中力偶或者分布载荷左端与简支梁左端的距离,第四列代表均匀载荷右端与简支梁左端的距离,当载荷为集中力或者集中力偶时,第四列为0.符号规定集中力和均匀载荷向下为正,向上为负,集中力偶顺时针为正,逆时针为负。
输出变量:内力数组XQM如果梁被分为NN-1段,则内力数组XQM为NN行,三列的数组,第一列代表梁的横截面的位置,第二列代表剪力,第三列代表弯矩。
剪力极值及位置QDXQDX是一个二行二列的数组,第一列代表极值所在的位置,第二列代表极值弯矩极值及位置MDXMDX是一个二行二列的数组,第一列代表极值所在的位置,第二列代表极值1.子程序1.1集中力偶对弯矩贡献的子函数QMM1.2集中力对剪力和弯矩贡献的子函数QMP1.3分布载荷对剪力和弯矩贡献的子函数QMQ1.4求剪力和弯矩极值的子函数MAX_MIN1.5绘制剪力图和弯矩图的子函数TU_QM2.计算分析程序2.1简支梁QMDJ2.2左端固定悬臂梁QMDXZ2.3右端固定悬臂梁QMDXY2.4左端外伸梁QMDWZ2.5右端外伸梁QMDWY2.6两端外伸梁QMDWL1.子程序1.1集中力偶对弯矩贡献的子函数QMMfunction MM=QMM(n,x1,a,M,MM)for j=1:nif x1(j)==an1=j;endendMM(n1:n)=MM(n1:n)+M;1.2集中力对剪力和弯矩贡献的子函数QMP function [QQ,MM]=QMP(n,x1,b,P,QQ,MM)for j=1:nif x1(j)==b;n1=j;endendQQ(n1:n)=QQ(n1:n)-P;MM(n1:n)=MM(n1:n)-P*(x1(n1:n)-b);1.3分布载荷对剪力和弯矩贡献的子函数QMQ function [QQ,MM]=QMQ(n,x1,c,d,q,QQ,MM)for j=1:nif x1(j)>cQQ(j)=QQ(j)-q*(x1(j)-c);MM(j)=MM(j)-0.5*q*(x1(j)-c)^2;endif x1(j)>dQQ(j)=QQ(j)+q*(x1(j)-d);MM(j)=MM(j)+0.5*q*(x1(j)-d)^2;endend1.4求剪力和弯矩极值的子函数MAX_MINfunction [QDX,MDX,XQM]=MAX_MIN(x1,QQ,MM) XQM=[x1',QQ',MM'];[Qmax,i]=max(QQ);Q1=[Qmax,x1(i)];[Qmin,i]=min(QQ);Q2=[Qmin,x1(i)];[Mmax,i]=max(MM);M1=[Mmax,x1(i)];[Mmin,i]=min(MM);M2=[Mmin,x1(i)];disp('剪力极值及位置')QDX=[Q1;Q2]disp('弯矩极值及位置')MDX=[M1;M2]t1=findobj(0,'Tag','text31');str=num2str(Q1(1));set(t1,'String',str);t2=findobj(0,'Tag','text39');str=num2str(Q1(2));set(t2,'String',str);t3=findobj(0,'Tag','text32');str=num2str(Q2(1));set(t3,'String',str);t4=findobj(0,'Tag','text40');str=num2str(Q2(2));set(t4,'String',str);m1=findobj(0,'Tag','text33');str=num2str(M1(1));set(m1,'String',str);m2=findobj(0,'Tag','text41');str=num2str(M1(2));set(m2,'String',str);m3=findobj(0,'Tag','text34');str=num2str(M2(1));set(m3,'String',str);m4=findobj(0,'Tag','text42');str=num2str(M2(2));set(m4,'String',str);1.5绘制剪力图和弯矩图的子函数TU_QM function TU_QM(x1,QQ,MM)h1=findobj(0,'Tag','axes1');axes(h1);plot(x1,QQ);grid;title('剪力图');h2=findobj(0,'Tag','axes2');axes(h2);plot(x1,MM);grid;title('弯矩图');2.计算分析程序2.1简支梁QMDJfunction XQM=QMDJ(x,MPQ)[n,m]=size(x);L=x(m);x1=[];for i=1:m-1x1=[x1,linspace(x(i),x(i+1),50)];endMM=zeros(size(x1));QQ=zeros(size(x1));[m,t]=size(MPQ);[t,n]=size(x1);for i=1:mswitch MPQ(i,1)case 1M=MPQ(i,2);a=MPQ(i,3);RA=-M/L;QQ=QQ+RA;MM=MM+RA*x1;if a>0 & a<LMM=QMM(n,x1,a,M,MM);endif a==0MM=MM+M;endcase 2P=MPQ(i,2);b=MPQ(i,3);RA=(L-b)*P/L;if b>0 & b<LQQ=QQ+RA;MM=MM+RA*x1;[QQ,MM]=QMP(n,x1,b,P,QQ,MM);endcase 3q=MPQ(i,2);c=MPQ(i,3);d=MPQ(i,4);RA=(L-0.5*(c+d))*q*(d-c)/L;QQ=QQ+RA;MM=MM+RA*x1+MA;[QQ,MM]=QMQ(n,x1,c,d,q,QQ,MM);endend[QDX,MDX,XQM]=MAX_MIN(x1,QQ,MM);TU_QM(x1,QQ,MM);disp('梁的有限元分析结果')disp('位置-----------剪力----------弯矩')2.2左端固定悬臂梁QMDXZfunction XQM=QMDXZ(x,MPQ)[n,m]=size(x);L=x(m);x1=[];for i=1:m-1x1=[x1,linspace(x(i),x(i+1),50)];endMM=zeros(size(x1));QQ=zeros(size(x1));[PN,t]=size(MPQ);[t,n]=size(x1);for i=1:PNswitch MPQ(i,1)case 1M=MPQ(i,2);a=MPQ(i,3);if a>0 & a<LMM=MM-M;MM=QMM(n,x1,a,M,MM);endif a==LMM=MM-M;endcase 2P=MPQ(i,2);b=MPQ(i,3);RA=P;MA=-P*b;QQ=QQ+RA;MM=MM+RA*x1+MA;if b>0 & b<L[QQ,MM]=QMP(n,x1,b,P,QQ,MM);endcase 3q=MPQ(i,2);c=MPQ(i,3);d=MPQ(i,4);RA=q*(d-c);MA=-0.5*q*(d-c)*(d+c);QQ=QQ+RA;MM=MM+RA*x1+MA;[QQ,MM]=QMQ(n,x1,c,d,q,QQ,MM);endend[QDX,MDX,XQM]=MAX_MIN(x1,QQ,MM);TU_QM(x1,QQ,MM);disp('梁的有限元分析结果')disp('位置-----------剪力----------弯矩')2.3右端固定悬臂梁QMDXYfunction XQM=QMDXY(x,MPQ)[n,m]=size(x);L=x(m);x1=[];for i=1:m-1x1=[x1,linspace(x(i),x(i+1),50)];endMM=zeros(size(x1));QQ=zeros(size(x1));[PN,t]=size(MPQ);[t,n]=size(x1);for i=1:PNswitch MPQ(i,1)case 1M=MPQ(i,2);a=MPQ(i,3);if a==0MM=MM+M;endif a>0 & a<LMM=QMM(n,x1,a,M,MM);endcase 2P=MPQ(i,2);b=MPQ(i,3);if b==0QQ=QQ-PMM=MM-P*x1;endif b>0 & b<L[QQ,MM]=QMP(n,x1,b,P,QQ,MM);endcase 3q=MPQ(i,2);c=MPQ(i,3);d=MPQ(i,4);[QQ,MM]=QMQ(n,x1,c,d,q,QQ,MM);endend[QDX,MDX,XQM]=MAX_MIN(x1,QQ,MM);TU_QM(x1,QQ,MM);disp('梁的有限元分析结果')disp('位置-----------剪力----------弯矩')2.4左端外伸梁QMDWZfunction XQM=QMDWZ(x,L1,MPQ)[n,m]=size(x);L=x(m);x1=[];for i=1:m-1x1=[x1,linspace(x(i),x(i+1),50)];endMM=zeros(size(x1));QQ=zeros(size(x1));[PN,t]=size(MPQ);[t,n]=size(x1);for i=1:PNswitch MPQ(i,1)case 1M=MPQ(i,2);a=MPQ(i,3);if a>0 & a<LMM=QMM(n,x1,a,M,MM);endif a==0MM=MM+M;endcase 2P=MPQ(i,2);b=MPQ(i,3);RA=P*(L-b)/(L-L1);[QQ,MM]=QMP(n,x1,L1,-RA,QQ,MM);if b>0 & b<L[QQ,MM]=QMP(n,x1,b,P,QQ,MM);endif b==0QQ=QQ-P;MM=MM-P*x1;endcase 3q=MPQ(i,2);c=MPQ(i,3);d=MPQ(i,4);b=(c+d)*0.5;P=(d-c)*q;RA=P*(L-b)/(L-L1);[QQ,MM]=QMP(n,x1,L1,-RA,QQ,MM);[QQ,MM]=QMQ(n,x1,c,d,q,QQ,MM);endend[QDX,MDX,XQM]=MAX_MIN(x1,QQ,MM);TU_QM(x1,QQ,MM);disp('梁的有限元分析结果')disp('位置-----------剪力----------弯矩')2.5右端外伸梁QMDWYfunction XQM=QMDWY(x,L1,MPQ)[n,m]=size(x);L=x(m);x1=[];for i=1:m-1x1=[x1,linspace(x(i),x(i+1),50)];endMM=zeros(size(x1));QQ=zeros(size(x1));[PN,t]=size(MPQ);[t,n]=size(x1);for i=1:PNswitch MPQ(i,1)case 1M=MPQ(i,2);a=MPQ(i,3);RA=-M/L1;RB=-RA;QQ=QQ+RA;MM=MM+x1*RA;if a>0 & a<LMM=QMM(n,x1,a,M,MM);endif a==0MM=MM+M;endcase 2P=MPQ(i,2);b=MPQ(i,3);RA=P*(L1-b)/L1;RB=P*b/L1;QQ=QQ+RA;MM=MM+x1*RA;[QQ,MM]=QMP(n,x1,L1,-RB,QQ,MM);if b>0 & b<L[QQ,MM]=QMP(n,x1,b,P,QQ,MM);endif b==0QQ=QQ-P;MM=MM-P*x1;endcase 3q=MPQ(i,2);c=MPQ(i,3);d=MPQ(i,4);b=(c+d)*0.5;P=(d-c)*q;RA=P*(L1-b)/L1;RB=P*b/L1;QQ=QQ+RA;MM=MM+x1*RA;[QQ,MM]=QMP(n,x1,L1,-RB,QQ,MM);[QQ,MM]=QMQ(n,x1,c,d,q,QQ,MM);endend[QDX,MDX,XQM]=MAX_MIN(x1,QQ,MM);TU_QM(x1,QQ,MM);disp('梁的有限元分析结果')disp('位置-----------剪力----------弯矩')2.6两端外伸梁QMDWLfunction XQM=QMDWL(x,L1,L2,MPQ)[n,m]=size(x);L=x(m);x1=[];for i=1:m-1x1=[x1,linspace(x(i),x(i+1),50)];endMM=zeros(size(x1));QQ=zeros(size(x1));[PN,t]=size(MPQ);[t,n]=size(x1);for i=1:PNswitch MPQ(i,1)case 1M=MPQ(i,2);a=MPQ(i,3);RA=-M/(L2-L1);RB=-RA;if a>0 & a<LMM=QMM(n,x1,a,M,MM);endif a==0MM=MM+M;endcase 2P=MPQ(i,2);b=MPQ(i,3);LL=L2-L1;bb=b-L1;RA=P*(LL-bb)/LL;RB=P*bb/LL;[QQ,MM]=QMP(n,x1,L1,-RA,QQ,MM);[QQ,MM]=QMP(n,x1,L2,-RB,QQ,MM);if b>0 & b<L[QQ,MM]=QMP(n,x1,b,P,QQ,MM);endif b==0QQ=QQ-P;MM=MM-P*x1;endcase 3q=MPQ(i,2);c=MPQ(i,3);d=MPQ(i,4);b=(c+d)*0.5;P=(d-c)*q;LL=L2-L1;bb=b-L1;RA=P*(LL-bb)/LL;RB=P*bb/LL;[QQ,MM]=QMP(n,x1,L1,-RA,QQ,MM);[QQ,MM]=QMP(n,x1,L2,-RB,QQ,MM);[QQ,MM]=QMQ(n,x1,c,d,q,QQ,MM);endend[QDX,MDX,XQM]=MAX_MIN(x1,QQ,MM);TU_QM(x1,QQ,MM);disp('梁的有限元分析结果')disp('位置-----------剪力----------弯矩')untitled.mfunction varargout = untitled(varargin)% UNTITLED M-file for untitled.fig% UNTITLED, by itself, creates a new UNTITLED or raises the existing% singleton*.%% H = UNTITLED returns the handle to a new UNTITLED or the handle to% the existing singleton*.%% UNTITLED('CALLBACK',hObject,eventData,handles,...) calls the local% function named CALLBACK in UNTITLED.M with the given input arguments. %% UNTITLED('Property','Value',...) creates a new UNTITLED or raises the% existing singleton*. Starting from the left, property value pairs are% applied to the GUI before untitled_OpeningFunction gets called. An% unrecognized property name or invalid value makes property application% stop. All inputs are passed to untitled_OpeningFcn via varargin.%% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one% instance to run (singleton)".%% See also: GUIDE, GUIDA TA, GUIHANDLES% Edit the above text to modify the response to help untitled% Last Modified by GUIDE v2.5 03-Jun-2008 23:12:06% Begin initialization code - DO NOT EDITgui_Singleton = 1;gui_State = struct('gui_Name', mfilename, ...'gui_Singleton', gui_Singleton, ...'gui_OpeningFcn', @untitled_OpeningFcn, ...'gui_OutputFcn', @untitled_OutputFcn, ...'gui_LayoutFcn', [] , ...'gui_Callback', []);if nargin && ischar(varargin{1})gui_State.gui_Callback = str2func(varargin{1});endif nargout[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); elsegui_mainfcn(gui_State, varargin{:});end% End initialization code - DO NOT EDIT% --- Executes just before untitled is made visible.function untitled_OpeningFcn(hObject, eventdata, handles, varargin) % This function has no output args, see OutputFcn.% hObject handle to figure% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDA TA) % varargin command line arguments to untitled (see V ARARGIN)% Choose default command line output for untitledhandles.output = hObject;% Update handles structureguidata(hObject, handles);% UIWAIT makes untitled wait for user response (see UIRESUME) % uiwait(handles.figure1);% --- Outputs from this function are returned to the command line. function varargout = untitled_OutputFcn(hObject, eventdata, handles) % varargout cell array for returning output args (see V ARARGOUT); % hObject handle to figure% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDA TA)% Get default command line output from handles structure varargout{1} = handles.output;function edit2_Callback(hObject, eventdata, handles)% hObject handle to edit2 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDA TA)% Hints: get(hObject,'String') returns contents of edit2 as text% str2double(get(hObject,'String')) returns contents of edit2 as a double% --- Executes during object creation, after setting all properties.function edit2_CreateFcn(hObject, eventdata, handles)% hObject handle to edit2 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white');endfunction edit3_Callback(hObject, eventdata, handles)% hObject handle to edit3 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDA TA)% Hints: get(hObject,'String') returns contents of edit3 as text% str2double(get(hObject,'String')) returns contents of edit3 as a double% --- Executes during object creation, after setting all properties.function edit3_CreateFcn(hObject, eventdata, handles)% hObject handle to edit3 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white');endfunction edit4_Callback(hObject, eventdata, handles)% hObject handle to edit4 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDA TA)% Hints: get(hObject,'String') returns contents of edit4 as text% str2double(get(hObject,'String')) returns contents of edit4 as a double% --- Executes during object creation, after setting all properties.function edit4_CreateFcn(hObject, eventdata, handles)% hObject handle to edit4 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white');end% --- Executes on selection change in popupmenu1.function popupmenu1_Callback(hObject, eventdata, handles)% hObject handle to popupmenu1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: contents = get(hObject,'String') returns popupmenu1 contents as cell array% contents{get(hObject,'Value')} returns selected item from popupmenu1% --- Executes during object creation, after setting all properties.function popupmenu1_CreateFcn(hObject, eventdata, handles)% hObject handle to popupmenu1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: popupmenu controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white');end% --- Executes on button press in pushbutton3.function pushbutton3_Callback(hObject, eventdata, handles)% hObject handle to pushbutton3 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDA TA)x=str2num(get(handles.edit2,'string'));MPQ=str2num(get(handles.edit3,'string'));L=str2num(get(handles.edit4,'string'));L1=L(1);L2=L(2);val=get(handles.popupmenu1,'Value');str=get(handles.popupmenu1,'String');switch str{val}case '简支梁'QMDJ(x,MPQ)case '左端固定悬臂梁'QMDXZ(x,MPQ)case '右端固定悬臂梁'QMDXY(x,MPQ)case '左端外伸梁'QMDWZ(x,L1,MPQ)case '右端外伸梁'QMDWY(x,L1,MPQ)case '两端外伸梁'QMDWL(x,L1,L2,MPQ)end% --- Executes on button press in pushbutton4.function pushbutton4_Callback(hObject, eventdata, handles)% hObject handle to pushbutton4 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) close all% --- Executes on key press over popupmenu1 with no controls selected. function popupmenu1_KeyPressFcn(hObject, eventdata, handles)% hObject handle to popupmenu1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDA TA)。