Function gear_opt1 clc; clear all; close all; n1=960; p1=10; n2=850; p2=8.6; x0=[2,3,27,27,4.13,pi/18,3.15,0.8]; [x,fval]=fmincon(@gearoptfun2,x0,[],[],[],[],[],[], @gearoptcons2,[],p1,p2,n1,n2) function f=gearoptfun2(x,p1,p2,n1,n2) f=((x(1)*x(3))*(1+x(5))+x(2)*x(4)*(1+13/x(5)))/(2*cos(x(6))); function[C,Ceq]=gearoptcons2(x,p1,p2,n1,n2) c(1)=2-x(1); c(2)=x(1)-5; c(3)=3.5-x(2); c(4)=x(2)-6; c(5)=18-x(3); c(6)=x(3)-32; c(7)=20-x(4); c(8)=x(4)-32; c(9)=1.3*x(5)-x(7); c(10)=x(7)-1.5*x(7); x(5)=13/x(7);k1=1.9; k2=1.92; x(6)=3.14/18; z1=189.8^(1/2)*2.5*sqrt((1+x(5))/x(5)); z2=189.8^(1/2)*2.5*sqrt((1+x(7))/x(7)); T1=9550*1000*p1/n1; T2=9550*1000*p2/n2; c(11)=z1*sqrt(2*k1*T2/(x(1)*x(3))^3*x(8)*1.7)-570; c(12)=z2*sqrt(2*k2*T2/(x(1)*x(3))^3*x(8)*1.64)-400; [YFa1,Ysa1]=yfasa(x(3)/(cos(6))^3); [YFa2,Ysa2]=yfasa(x(5)*x(3)/(cos(6))^3); [YFa3,Ysa3]=yfasa(x(4)/(cos(6))^3); [YFa4,Ysa4]=yfasa(x(7)*x(4)/(cos(6))^3); c(13)=2*k1*T1/(x(1)^3*x(3)^2*x(8)*1.7)*YFa1*Ysa1*0.88-440; c(14)=2*k1*T1/(x(1)^3*x(3)^2*x(8)*1.7)*YFa2*Ysa2*0.88-330; c(15)=2*k2*T2/(x(2)^3*x(4)^2*x(8)*1.64)*YFa1*Ysa1*0.88-440; c(16)=2*k2*T2/(x(2)^3*x(4)^2*x(8)*1.64)*YFa2*Ysa2*0.88-330; ceq=[]; function[yfa,ysa]=yfasa(z) x=[17 18 19 20 21 22 23 24 25 26 27 28 29 30 35 40 45 50 60 70 80 90 100 150]; y1=[2.97 2.91 2.85 2.80 2.76 2.72 2.69 2.65 2.62 2.60 2.57 2.55 2.53 2.52 2.45 2.40 2.35 2.32 2.28 2.24 2.22 2.20 2.18 2.14]; y2=[1.52 1.53 1.54 1.55 1.56 1.57 1.575 1.58 1.59 1.595 1.60 1.61 1.62 1.625 1.65 1.67 1.68 1.70 1.73 1.75 1.77 1.78 1.79 1.83];
建议给出这个程序的背景,如用于优化什么东西,便于回答。这里就程序简单回答一下,使用fmincon函数求得目标函数gearoptfun2的最小值,等式约束条件为gearoptcons2。