求助:用fmincon 函数 怎么才能输出 更多的信息 比如:exitflag。

如下设置:
options = optimset('Display','iter','Algorithm','interior-point');
[k,fval,exitflag,output,lambda,grad,hessian] = fmincon(@ObjFunc4Fmincon,k0,[],[],[],[],lb,ub,[],options,l);
结果只显示了如下信息,但并没有得到: exitflag,output 的具体信息比如步长等
First-order Norm of
Iter F-count f(x) Feasibility optimality step
0 11 3.775940e+05 0.000e+00 4.282e-05
1 22 3.775940e+05 0.000e+00 9.049e-05 2.602e-03
2 33 3.775940e+05 0.000e+00 1.421e-04 1.690e-02
3 44 3.775940e+05 0.000e+00 1.421e-04 6.279e-02
4 55 3.775940e+05 0.000e+00 9.035e-05 1.548e-01
5 66 3.775940e+05 0.000e+00 1.145e-04 3.132e-01
6 77 3.775940e+05 0.000e+00 1.421e-04 6.721e-01
7 88 3.775940e+05 0.000e+00 1.421e-04 1.624e+00
8 99 3.775940e+05 0.000e+00 1.421e-04 2.400e+00
9 126 3.775940e+05 0.000e+00 7.916e-05 9.972e-05
10 137 3.775940e+05 0.000e+00 7.894e-05 1.430e+00
11 148 3.775940e+05 0.000e+00 7.829e-05 4.120e+00
12 159 3.775940e+05 0.000e+00 8.543e-05 9.594e-03
13 170 3.775940e+05 0.000e+00 8.391e-05 2.930e-01
14 181 3.775940e+05 0.000e+00 8.379e-05 3.061e-01
15 192 3.775940e+05 0.000e+00 9.345e-05 6.349e-02
16 203 3.775940e+05 0.000e+00 9.345e-05 1.409e-01
17 214 3.775940e+05 0.000e+00 4.189e-05 6.292e-02
18 225 3.775940e+05 0.000e+00 1.905e-05 5.055e-02
19 236 3.775940e+05 0.000e+00 2.664e-05 1.604e-02
20 247 3.775940e+05 0.000e+00 2.477e-05 1.105e-02
21 258 3.775940e+05 0.000e+00 2.466e-05 5.360e-03
22 269 3.775940e+05 0.000e+00 2.425e-05 1.402e-03
23 280 3.775940e+05 0.000e+00 2.235e-05 5.137e-03
24 291 3.775940e+05 0.000e+00 1.764e-05 1.714e-02
Optimization stopped because the relative changes in all elements of x are
less than options.TolX = 1.000000e-10, and the relative maximum constraint
violation, 0.000000e+00, is less than options.TolCon = 1.000000e-06.
Optimization Metric Options
max(abs(delta_x./x)) = 6.28e-11 TolX = 1e-10 (default)
relative max(constraint violation) = 0.00e+00 TolCon = 1e-06 (default)

 Accepted Answer

kiniveb
kiniveb on 24 Nov 2022

0 votes

因为你调用 fmincon 的语句后面加了分号,所以,返回值没有在 command window 里显示出来,但不代表这些值没有计算得到。你可以在 workspace 里双击该变量名查看,亦可以在command window里输入变量回车查看,还可以直接去掉 fmincon 语句最后面的分号,则所以的返回值会全部显示在 command window 里

More Answers (0)

Tags

Asked:

on 24 Nov 2022

Answered:

on 24 Nov 2022

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!