functionconcreten=input('请输入需要计算的个数:');%输入截面参数,并计算截面面积disp('请依次输入截面宽度和高度、计算长度(单位毫米):')b=zeros(1,n);h=zeros(1,n);A=zeros(1,n);L0=zeros(1,n);fori=1:nb(1,i)=input('');h(1,i)=input('');L0(i)=input('');A(1,i)=b(1,i)*h(1,i);end%输入混凝土型号、钢筋型号,确定基本参数disp('请输入混凝土型号、钢筋型号(混凝土标号在C25~C50之间,钢筋在HPB300~HRB400之间,字母大写):')concrete=input('','s');steel=input('','s');switch(concrete)case'C25'fc=11.9;case'C30'fc=14.3;case'C35'fc=16.7;case'C40'fc=19.1;case'C45'fc=21.1;case'C50'fc=23.1;otherwisedisp('混凝土标号输入错误!');return;endswitch(steel)case'HPB300'fy=270;kesai=0.576;case'HRB335'fy=300;kesai=0.550;case'HRB400'fy=360;kesai=0.518;otherwisedisp('钢筋标号输入错误!');return;end%输入保护层厚度as=input('请输入受拉区保护层厚度:');as_1=input('请输入受压区保护层厚度:');%计算参数e0=zeros(1,n);ei=zeros(1,n);e=zeros(1,n);ei_1=zeros(1,n);h0=zeros(1,n);kesai_1=zeros(1,n);As=zeros(1,n);As_1=zeros(1,n);M=zeros(1,n);%调整后的弯矩N=zeros(1,n);%轴力M1=zeros(1,n);%上端弯矩M2=zeros(1,n);%下端弯矩Cm=zeros(1,n);%考虑附加弯矩计算参数1Ym=zeros(1,n);%考虑附加弯矩计算参数2Xc=zeros(1,n);%考虑附加弯矩计算参数3Xc_1=zeros(1,n);%考虑附加弯矩计算参数4ea=zeros(1,n);fori=1:nfprintf('请输入第%d号构件的轴力(单位KN):',i);N(i)=input('');h0(i)=h(i)-as;fprintf('第%d号构件是否考虑附加弯矩(',i);yes=input('考虑请输入1,不考虑请输入0):');%考虑附加弯矩的影响ifyes==1fprintf('请分别输入第%d号构件的上(左)端弯矩、下(右)端弯矩(单位KN.m):\r',i);M1(i)=input('');M2(i)=input('');%比较M1和M2绝对值的大小x1=abs(M1(i));x2=abs(M2(i));ifM1(i)*M2(i)=0%判断是否为单曲率弯曲if(x1x2)x3=x1;M1(i)=x2;M2(i)=x3;elseM1(i)=x1;M2(i)=x2;endCm(i)=0.7+0.3*M1(i)/M2(i);elseif(x1x2)x3=x1;M1(i)=x2;M2(i)=x3;elseM1(i)=x1;M2(i)=x2;endCm(i)=0.7-0.3*M1(i)/M2(i);endifCm(i)0.7Cm(i)=0.7;endXc(i)=0.5*fc*A(i)/N(i)/1000;ifXc(i)1Xc(i)=1;endea(i)=max(20,h(i)/30);Ym(i)=Fujia(M2(i),N(i),ea(i),h0(i),L0(i),h(i),Xc(i));Xc_1(i)=Ym(i)*Cm(i);ifXc_1(i)1.0Xc_1(i)=1.0;endM(i)=Xc_1(i)*M2(i);elseifyes==0M(i)=input('请输入计算弯矩大小:');ea(i)=max(20,h(i)/30);elsereturn;endende0(i)=M(i)/N(i)*10^3;ei(i)=e0(i)+ea(i);e(i)=ei(i)+h(i)/2-as;ei_1(i)=abs(ei(i)-h(i)/2+as_1);kesai_1(i)=N(i)*10^3/(fc*b(i)*h0(i));end%计算考虑附加弯矩参数2functiony=Fujia(a,b,c,d,e,f,g)y=1+(e/f)^2*g*d/1300/(a/b*1000+c);end%开始计算%判断大小偏压,并计算配筋面积fori=1:nifkesai_1(i)kesaifprintf('********第%d号构件配筋面积按照大偏压计算确定********',i);ifkesai_1(i)=(2*as_1/h0(i))As(i)=Dapianya(N(i),e(i),fc,b(i),h0(i),kesai_1(i),fy,as_1);As_1(i)=As(i);elseAs(i)=Dapianya_1(N(i),ei_1(i),fy,h0(i),as_1);As_1(i)=As(i);endfprintf('\r配筋面积为:');fprintf('%8.4fmm2\r',As(i));elsefprintf('********第%d号构件配筋面积按照小偏压计算确定********',i);kesai_1(i)=Xiaopianya(N(i),fc,b(i),h0(i),kesai,e(i),0.8,as_1);As(i)=Dapianya(N(i),e(i),fc,b(i),h0(i),kesai_1(i),fy,as_1);fprintf('\r配筋面积为:');fprintf('%8.4fmm2\r',As(i));As_1(i)=As(i);s(i)=Dapianya(N(i),e(i),fc,b(i),h(i),kesai_1(i),fy,as_1);As_1(i)=As(i);endendfori=1:nifAs_1(i)=(0.002*b(i)*h(i))As_1(i)=0.002*b(i)*h(i);As(i)=As_1(i);fprintf('第%d号构件不满足最小配筋率,按照构造要求配置',i);endend%大小偏压计算函数%大偏压functiony=Dapianya(a,b,c,d,e,f,g,h)y=(a*10^3*b-c*d*e^2*f*(1-0.5*f))/(g*(e-h));endfunctiony=Dapianya_1(a,b,c,d,e)y=a*10^3*b/(c*(d-e));end%小偏压functiony=Xiaopianya(a,b,c,d,e,f,g,h)y=(a*10^3-b*c*d*e)/((a*10^3*f-0.43*b*c*d^2)/(g-e)/(d-h)+b*c*d)+e;end%输出结果到文件fid=fopen('d:\concrete.txt','w');x=1:n;y=[x;M;N;b;h;As];fprintf(fid,'%d%8.4f%d%d%d%8.4f\r\n',y);fclose(fid);end