Why fmincon gives different objfun values with the same values of variables?

1 Ansicht (letzte 30 Tage)
Dear all, I am trying to use fmincon to maximize an objective function, which includes a system of odes to be solved. I tried to store the x values (x is a vector of 3 elements) and fval values at every iteration. Below is the part of the message that fmincon gave me:
Local minimum possible. Constraints satisfied. fmincon stopped because the size of the current step is less than the default value of the step size tolerance and constraints are satisfied to within the default value of the constraint tolerance. criteria details
x: [4x3 double]
fval: [4x1 double]
iterations: 4
funcCount: 68
constrviolation: 0
stepsize: 2.4333e-10
algorithm: 'interior-point'
firstorderopt: 1.6806e+09
cgiterations: 39
message: 'Local minimum possible. Constraints satisfied.
fmincon s...'
>>My question is why the last two values of fval are different while the values of x are identical (shown in the table). I also checked the intermediate values (values at each funevaluations), and found that the objective function was called for a number of times with the same set of x vales!!!!
Could anyone please explain the possible reasons??
Many many thanks in advance.
Best regards Mahmudul

Antworten (1)

Walter Roberson
Walter Roberson am 28 Aug. 2015
Before you display the values for that table, give the command
format long g
and then look at the values again. You will probably find that the values differ after the 5th decimal point.
  6 Kommentare
Mi Tung
Mi Tung am 7 Okt. 2020
Can you show me this please, Mr. Mario. I haven't done yet this.
Walter Roberson
Walter Roberson am 7 Okt. 2020
If you are using the variable browser, then you can drag the boundaries of each column.

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

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

Start Hunting!

Translated by