how to make fmincon run with more others value of variable.
2 views (last 30 days)
Show older comments
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?
Could anyone please help me this question??
Many thanks in advance.
Best regards, Tung
0 Comments
Accepted Answer
Steven Lord
on 7 Oct 2020
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
0 Comments
More Answers (1)
Hiro Yoshino
on 7 Oct 2020
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.
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!