资源描述:
《《材料力学编程》word版》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、材料力学上机作业第一题一个力作用下的任意截面的弯矩,挠度源程序为:#include#includemain(){doubleFi,ai,bi,l,E,I,x,M,v;printf("请输入:Fi,ai,bi,E,I,x:");scanf("%lf,%lf,%lf,%lf,%lf,%lf",&Fi,&ai,&bi,&E,&I,&x);l=ai+bi;if((x>=0)&&(x<=ai)){M=Fi*bi*x/l;v=-Fi*bi*x*(l*l-x*x-bi*bi)/(6*E*I*l);printf("M=%lf
2、,v=%lf",M,v);}if((x>ai)&&(x<=l)){M=Fi*ai*(l-x)/l;v=-Fi*bi*(l*(x-ai)*(x-ai)*(x-ai)/bi+(l*l-bi*bi)*x-x*x*x)/(6*E*I*l);printf("计算结果为:M=%lf,v=%lf",M,v);}if((x<0)
3、
4、(x>l)){printf("有错误!");}}Fi=300N,ai=60m,bi=200m,E=200000000000Pa,I=0.0001m4,x=80m,程序运行结果为:v材料力学上机作业第二题1一个力偶作用下的任
5、意截面的弯矩,挠度#include#includemain(){doubleMk,ak,bk,l,E,I,x,M,v;printf("请输入Mk,ak,bk,E,I,x:");scanf("%lf,%lf,%lf,%lf,%lf,%lf",&Mk,&ak,&bk,&E,&I,&x);l=ak+bk;if((x>=0)&&(x<=ak)){M=-Mk*x/l;v=Mk*x*(l*l-3*bk*bk-x*x)/(6*E*I*l);printf("M=%lf,v=%lf",M,v);}if((x>ak)&&(x
6、<=l)){M=Mk*(1-x/l);v=-Mk*(-x*x*x+3*l*(x-ak)*(x-ak)+(l*l-3*bk*bk)*x)/(6*E*I*l);printf("M=%lf,v=%lf",M,v);}if((x<0)
7、
8、(x>l)){printf("错误!");}}令Mk=200N·m,ak=100m,bk=100m,E=200000000000Pa,I=0.0001m4,x=100m,程序运行结果为:2一段分布力作用下的任意截面的弯矩,挠度源程序为:#include#includemain()
9、{doubleq,ai,bi,ci,l,E,I,x,M,v;doubleFa,Fb,c1,c2,c3,d3;printf("请输入:q,ai,bi,ci,E,I,x:");scanf("%lf,%lf,%lf,%lf,%lf,%lf,%lf",&q,&ai,&bi,&ci,&E,&I,&x);l=ai+bi+ci;Fa=(q*ci*(ci+2*bi))/(2*l);Fb=(q*ci*(ci+2*ai))/(2*l);c3=(Fa*pow((ai+ci),3))/(3*l)-(q*ai*pow(ci,3))/(6*l)-(q*pow(ci,4)
10、)/(8*l)+(Fb*pow(bi,2))/2-(Fb*pow(bi,3))/(3*l);c2=c3-(Fb*pow(bi,2))/2-(Fa*pow((ai+ci),2))/2+(q*pow(ci,3))/6;c1=c2;d3=-c3*l;if((x>=0)&&(x<=ai)){M=Fa*x;v=((Fa*pow(x,3))/6+c1*x)/(E*I);printf("M=%lf,v=%lf",M,v);}if((x>ai)&&(x<=ai+ci)){M=((q*ci*x*(ci+2*bi))/(2*l))-((q*pow((x-ai),
11、2))/2);v=((Fa*pow(x,3))/6-(q*pow((x-ai),4))/24+c2*x)/(E*I);printf("M=%lf,v=%lf",M,v);}if((x>ai+ci)&&(x<=l)){M=Fb*(l-x);v=((Fb*pow((l-x),3))/6+c3*x+d3)/(E*I);printf("M=%lf,v=%lf",M,v);}if((x<0)
12、
13、(x>l)){printf("有错误!");}}q=200N/m,ai=100m,bi=200,ci=100m,E=200000000000Pa,I=0
14、.0001m4,x=70m,程序运行结果为:材料力学上机作业第三题n个力共同作用下的任意截面的弯矩,挠度源程序为:#include