MATLAB: How to make fmincon run with more others value of variable.


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

Best Answer

  • 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 =
    >> z = x + 1e-6
    z =
    >> ty = tan(y)
    ty =
    >> tz = tan(z)
    tz =
    >> difference = z - y
    difference =