matlab多元非线性 5
y=1.314x1+0.882x2=0.501x3+0.339x4+0.288x5+0.351x6+0.689x7-0.245(x1^2+x2^2+x3^2+x4^2+x...
y=1.314x1+0.882x2=0.501x3+0.339x4+0.288x5+0.351x6+0.689x7-0.245(x1^2+x2^2+x3^2+x4^2+x5^2+x62+x7^2)
x1+x2+x3+..+x7<=4.2
用matlab怎么求y最小值情况下的各x的值啊 展开
x1+x2+x3+..+x7<=4.2
用matlab怎么求y最小值情况下的各x的值啊 展开
1个回答
展开全部
如果不限定x1-x7大于0
y没有最小值
限定x1-x7大于等于0 y等于0,其他的x约为0
y=@(x)1.314*x(1)+0.882*x(2)+0.501*x(3)+0.339*x(4)+0.288*x(5)+0.351*x(6)+0.689*x(7)-0.245*(x(1).^2+x(2).^2+x(3).^2+x(4).^2+x(5).^2+x(6).^2+x(7).^2);
>> [x,feval,flag]=fmincon(y,[1 1 0 0 0 0 0],[1 1 1 1 1 1 1 ],[4.2],[],[],[],[])
Warning: Trust-region-reflective algorithm does not solve this type of problem, using active-set
algorithm. You could also try the interior-point or sqp algorithms: set the Algorithm option to
'interior-point' or 'sqp' and rerun. For more help, see Choosing the Algorithm in the
documentation.
> In fmincon at 472
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 were satisfied to within the default value of the constraint tolerance.
<stopping criteria details>
No active inequalities.
x =
1.0e+019 *
-3.3332 -0.7420 -1.3959 -0.4237 -0.1147 -0.4953 -2.5247
feval =
-5.0033e+038
flag =
1
>> [x,feval,flag]=fmincon(y,[1 1 0 0 0 0 0],[1 1 1 1 1 1 1 ],[4.2],[],[],[0 0 0 0 0 0 0],[])
Warning: Trust-region-reflective algorithm does not solve this type of problem, using active-set
algorithm. You could also try the interior-point or sqp algorithms: set the Algorithm option to
'interior-point' or 'sqp' and rerun. For more help, see Choosing the Algorithm in the
documentation.
> In fmincon at 472
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 were satisfied to within the default value of the constraint tolerance.
<stopping criteria details>
Active inequalities (to within options.TolCon = 1e-006):
lower upper ineqlin ineqnonlin
1
2
3
4
5
6
7
x =
1.0e-016 *
0.2776 0 0 0 0 0 0
feval =
3.6471e-017
flag =
1
y没有最小值
限定x1-x7大于等于0 y等于0,其他的x约为0
y=@(x)1.314*x(1)+0.882*x(2)+0.501*x(3)+0.339*x(4)+0.288*x(5)+0.351*x(6)+0.689*x(7)-0.245*(x(1).^2+x(2).^2+x(3).^2+x(4).^2+x(5).^2+x(6).^2+x(7).^2);
>> [x,feval,flag]=fmincon(y,[1 1 0 0 0 0 0],[1 1 1 1 1 1 1 ],[4.2],[],[],[],[])
Warning: Trust-region-reflective algorithm does not solve this type of problem, using active-set
algorithm. You could also try the interior-point or sqp algorithms: set the Algorithm option to
'interior-point' or 'sqp' and rerun. For more help, see Choosing the Algorithm in the
documentation.
> In fmincon at 472
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 were satisfied to within the default value of the constraint tolerance.
<stopping criteria details>
No active inequalities.
x =
1.0e+019 *
-3.3332 -0.7420 -1.3959 -0.4237 -0.1147 -0.4953 -2.5247
feval =
-5.0033e+038
flag =
1
>> [x,feval,flag]=fmincon(y,[1 1 0 0 0 0 0],[1 1 1 1 1 1 1 ],[4.2],[],[],[0 0 0 0 0 0 0],[])
Warning: Trust-region-reflective algorithm does not solve this type of problem, using active-set
algorithm. You could also try the interior-point or sqp algorithms: set the Algorithm option to
'interior-point' or 'sqp' and rerun. For more help, see Choosing the Algorithm in the
documentation.
> In fmincon at 472
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 were satisfied to within the default value of the constraint tolerance.
<stopping criteria details>
Active inequalities (to within options.TolCon = 1e-006):
lower upper ineqlin ineqnonlin
1
2
3
4
5
6
7
x =
1.0e-016 *
0.2776 0 0 0 0 0 0
feval =
3.6471e-017
flag =
1
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询