matlab中二元函数有约束求极值的问题 10
函数是P=(x-2)*(-0.5133*x+5.042)*(-0.0426*y.^2+0.4092*y+1.0187)-y约束条件是2≤x≤9.80≤y≤7要怎么求得极值...
函数是P=(x-2)*(-0.5133*x+5.042)*(-0.0426*y.^2+0.4092*y+1.0187)-y
约束条件是
2≤x≤9.8
0≤y≤7
要怎么求得极值啊?
有个地方错了 P=10^(-4)*(x-2)*(-0.5133*x+5.042)*(-0.0426*y.^2+0.4092*y+1.0187)-y
求极大值 展开
约束条件是
2≤x≤9.8
0≤y≤7
要怎么求得极值啊?
有个地方错了 P=10^(-4)*(x-2)*(-0.5133*x+5.042)*(-0.0426*y.^2+0.4092*y+1.0187)-y
求极大值 展开
展开全部
>> P=@(x)(x(1)-2)*(-0.5133*x(1)+5.042)*(-0.0426*x(2).^2+0.4092*x(2)+1.0187)-x(2);
lb=[2;0];ub=[9.8;7];x0=[1;1];[x,fval]=fmincon(P,x0,[],[],[],[],lb,ub)
Local minimum found that satisfies the constraints.
Optimization completed because the objective function is non-decreasing in
feasible directions, to within the default value of the function tolerance,
and constraints are satisfied to within the default value of the constraint tolerance.
<stopping criteria details>
x =
2.0000
7.0000
fval =
-7.0000
上述说明:当x=2,y=7时有极小值p=-7
lb=[2;0];ub=[9.8;7];x0=[1;1];[x,fval]=fmincon(P,x0,[],[],[],[],lb,ub)
Local minimum found that satisfies the constraints.
Optimization completed because the objective function is non-decreasing in
feasible directions, to within the default value of the function tolerance,
and constraints are satisfied to within the default value of the constraint tolerance.
<stopping criteria details>
x =
2.0000
7.0000
fval =
-7.0000
上述说明:当x=2,y=7时有极小值p=-7
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询