急!!!matlab 如何完成非线性约束优化
小弟想用matlab求下面的最小值:目标函数:f=0.5*[1.067*10^7-1169*x(1)+8.82*x(1)^2-0.003*x(1)^3+4.53*10^-...
小弟想用matlab求下面的最小值:
目标函数:f=0.5*[1.067*10^7-1169*x(1)+8.82*x(1)^2-0.003*x(1)^3+4.53*10^-7*x(1)^4]+8.89/[-9506-0.0083*x(1)^2/x(2)^2-0.00023(-3641.48+x(1))*(395.84+x(1))*x(2)];
约束条件:x(1)+x(2)<2505.7;
-x(1)-x(2)<-1203.9
也就是 1200<x(1)<2500;
3.9<x(2)<5.571;
哪位高人能帮小弟一下!小弟不胜感激!在线等!!!急用! 展开
目标函数:f=0.5*[1.067*10^7-1169*x(1)+8.82*x(1)^2-0.003*x(1)^3+4.53*10^-7*x(1)^4]+8.89/[-9506-0.0083*x(1)^2/x(2)^2-0.00023(-3641.48+x(1))*(395.84+x(1))*x(2)];
约束条件:x(1)+x(2)<2505.7;
-x(1)-x(2)<-1203.9
也就是 1200<x(1)<2500;
3.9<x(2)<5.571;
哪位高人能帮小弟一下!小弟不胜感激!在线等!!!急用! 展开
1个回答
展开全部
编写M文件fun.m
function f=fun(x)
f=0.5*(1.067*10^7-1169*x(1)+8.82*x(1)^2-0.003*x(1)^3+4.53*10^7-x(1)^4)+8.89/(-9506-0.0083*x(1)^2/x(2)^2-0.00023*(-3641.48+x(1))*(395.84+x(1))*x(2));
命令窗口输入
>> [x,fval]=fmincon('fun',rand(2,1),[],[],[],[],[1200;3.9],[2500;5.571])
Warning: Large-scale (trust region) method does not currently solve this type of problem,
switching to medium-scale (line search).
> In fmincon at 260
Optimization terminated: first-order optimality measure less
than options.TolFun and maximum constraint violation is less
than options.TolCon.
Active inequalities (to within options.TolCon = 1e-006):
lower upper ineqlin ineqnonlin
1
x =
1.0e+003 *
2.5000
0.0039
fval =
-1.9531e+013
你的目标函数我做了改动,你看看一致不
function f=fun(x)
f=0.5*(1.067*10^7-1169*x(1)+8.82*x(1)^2-0.003*x(1)^3+4.53*10^7-x(1)^4)+8.89/(-9506-0.0083*x(1)^2/x(2)^2-0.00023*(-3641.48+x(1))*(395.84+x(1))*x(2));
命令窗口输入
>> [x,fval]=fmincon('fun',rand(2,1),[],[],[],[],[1200;3.9],[2500;5.571])
Warning: Large-scale (trust region) method does not currently solve this type of problem,
switching to medium-scale (line search).
> In fmincon at 260
Optimization terminated: first-order optimality measure less
than options.TolFun and maximum constraint violation is less
than options.TolCon.
Active inequalities (to within options.TolCon = 1e-006):
lower upper ineqlin ineqnonlin
1
x =
1.0e+003 *
2.5000
0.0039
fval =
-1.9531e+013
你的目标函数我做了改动,你看看一致不
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询