matlab遗传算法实例求指导个这样的函数y=(0.0206*x(2)^2/(2*9.81*x(1))+(0.5*(1-(x(2)/(4*x(3)*9.81*(x(4)-1040)/(3*0.43*1040))^0.5*(1-(x(3)/x(1))^2)*exp(-(2.65*x(5)-3.32*x(5)^2.2))))+((0.25*(x(2)/(4*x(3)*9.81*(x(4)-1040)/(3*0.43*1040))^0.5*(
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/18 01:22:32
matlab遗传算法实例求指导个这样的函数y=(0.0206*x(2)^2/(2*9.81*x(1))+(0.5*(1-(x(2)/(4*x(3)*9.81*(x(4)-1040)/(3*0.43*1040))^0.5*(1-(x(3)/x(1))^2)*exp(-(2.65*x(5)-3.32*x(5)^2.2))))+((0.25*(x(2)/(4*x(3)*9.81*(x(4)-1040)/(3*0.43*1040))^0.5*(
matlab遗传算法实例求指导
个这样的函数y=(0.0206*x(2)^2/(2*9.81*x(1))+(0.5*(1-(x(2)/(4*x(3)*9.81*(x(4)-1040)/(3*0.43*1040))^0.5*(1-(x(3)/x(1))^2)*exp(-(2.65*x(5)-3.32*x(5)^2.2))))+((0.25*(x(2)/(4*x(3)*9.81*(x(4)-1040)/(3*0.43*1040))^0.5*(1-(x(3)/x(1))^2)*exp(-(2.65*x(5)-3.32*x(5)^2.2)))-1)^2+x(5)*x(2)/(4*x(3)*9.81*(x(4)-1040)/(3*0.43*1040))^0.5*(1-(x(3)/x(1))^2)*exp(-(2.65*x(5)-3.32*x(5)^2.2)))^0.5)*(x(4)/1040-1)+1.8413*(x(2)/(9.81*x(1)))^2.7736*(0.5*(1-(x(2)/(4*x(3)*9.81*(x(4)-1040)/(3*0.43*1040))^0.5*(1-(x(3)/x(1))^2)*exp(-(2.65*x(5)-3.32*x(5)^2.2))))+((0.25*(x(2)/(4*x(3)*9.81*(x(4)-1040)/(3*0.43*1040))^0.5*(1-(x(3)/x(1))^2)*exp(-(2.65*x(5)-3.32*x(5)^2.2)))-1)^2+x(5)*x(2)/(4*x(3)*9.81*(x(4)-1040)/(3*0.43*1040))^0.5*(1-(x(3)/x(1))^2)*exp(-(2.65*x(5)-3.32*x(5)^2.2)))^0.5)*0.43*x(3)/x(1)*(x(4)/1040-1))/(x(4)*x(5)/1040);
五个自变量,自变量之间没有任何的约束关系,但是自变量有范围,x(1)=[0.2,0.4],x(2)=[1.234,3],x(3)=[0.01,0.04],x(4)=[1190,1398],x(5)=[0.15,0.4],哎,试了很多天了还是不行,劳烦大神指点看怎么编程,不管用遗传算法ga或者fmincon,只要能出自变量范围内的结果就行,)
matlab遗传算法实例求指导个这样的函数y=(0.0206*x(2)^2/(2*9.81*x(1))+(0.5*(1-(x(2)/(4*x(3)*9.81*(x(4)-1040)/(3*0.43*1040))^0.5*(1-(x(3)/x(1))^2)*exp(-(2.65*x(5)-3.32*x(5)^2.2))))+((0.25*(x(2)/(4*x(3)*9.81*(x(4)-1040)/(3*0.43*1040))^0.5*(
主函数m文件代码:
lb=[0.2 1.234 0.01 1190 0.15];
ub=[0.4 3 0.04 1398 0.4];
x0=lb;
[x,fval]=fmincon('llzy',x0,[],[],[],[],lb,ub);
目标函数m文件代码:
function y=llzy(x)
y=(0.0206*x(2)^2/(2*9.81*x(1))+(0.5*(1-(x(2)/(4*x(3)*9.81*(x(4)-1040)/(3*0.43*1040))^0.5*(1-(x(3)/x(1))^2)*exp(-(2.65*x(5)-3.32*x(5)^2.2))))+((0.25*(x(2)/(4*x(3)*9.81*(x(4)-1040)/(3*0.43*1040))^0.5*(1-(x(3)/x(1))^2)*exp(-(2.65*x(5)-3.32*x(5)^2.2)))-1)^2+x(5)*x(2)/(4*x(3)*9.81*(x(4)-1040)/(3*0.43*1040))^0.5*(1-(x(3)/x(1))^2)*exp(-(2.65*x(5)-3.32*x(5)^2.2)))^0.5)*(x(4)/1040-1)+1.8413*(x(2)/(9.81*x(1)))^2.7736*(0.5*(1-(x(2)/(4*x(3)*9.81*(x(4)-1040)/(3*0.43*1040))^0.5*(1-(x(3)/x(1))^2)*exp(-(2.65*x(5)-3.32*x(5)^2.2))))+((0.25*(x(2)/(4*x(3)*9.81*(x(4)-1040)/(3*0.43*1040))^0.5*(1-(x(3)/x(1))^2)*exp(-(2.65*x(5)-3.32*x(5)^2.2)))-1)^2+x(5)*x(2)/(4*x(3)*9.81*(x(4)-1040)/(3*0.43*1040))^0.5*(1-(x(3)/x(1))^2)*exp(-(2.65*x(5)-3.32*x(5)^2.2)))^0.5)*0.43*x(3)/x(1)*(x(4)/1040-1))/(x(4)*x(5)/1040);