# how to make fmincon run with more others value of variable.

1 ビュー (過去 30 日間)
Mi Tung 2020 年 10 月 7 日

Hi everone. I'm using fmincon and in the output of fmincon i got the results that showed in the picture. As the picture show, I saw almost value of variable in each iteration has same. So I have this question: how to make fmincon run with more others value of variable?
Best regards, Tung

サインインしてコメントする。

### 採用された回答

Steven Lord 2020 年 10 月 7 日
The values of the variables used to compute the objective function are likely not the same. They are close enough that when displayed to five decimal places they are displayed the same but the stored values used for computation are not the same. As an extreme example, y and z are not the same number (as you can see from the difference variable) but they're close enough that they're displayed the same in format short. But since they're on opposite sides of the singularity of the tangent function, they results of computing with y versus z are quite different.
>> format short
>> x = pi/2;
>> y = x - 1e-6
y =
1.5708
>> z = x + 1e-6
z =
1.5708
>> ty = tan(y)
ty =
1.0000e+06
>> tz = tan(z)
tz =
-1.0000e+06
>> difference = z - y
difference =
2.0000e-06

サインインしてコメントする。

### その他の回答 (1 件)

Hiro 2020 年 10 月 7 日
There seems to be something wrong with your syntax. Look at the documentation for this function with great care:
Also there is another way to perform optimizations.
That is "Problem-based optimization" approach.
This may ease your burdon in programming optimization problems. It is worth trying out.

サインインしてコメントする。

### Community Treasure Hunt

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

Start Hunting!

Translated by