Assume I have some .m file with a function (and it's gradient) to be used by
fminunc() in MATLAB for some unconstrained optimization problem.
To solve the problem in the most simple way, I do this:
clear all [x,fval] = fminunc(@fun, [1;1])
This will minimize
fval and return the optimized values of
x. For a more accurate optimization, I do this:
clear all op = optimset('GradObj', 'on', 'LargeScale', 'off'); [x,fval] = fminunc(@fun, [1;1], op)
x values still are the solution to the problem only that now they are more accurate, because of the supplied gradient. Correct?
Both of the above methods use the line-search algorithm but I can also use the trust-region algorithm, like this:
clear all op = optimset('GradObj', 'on'); [x,fval] = fminunc(@fun, [1;1], op)
x values are different from the previous ones. What does this mean? Is this algorithm better or worse? Or maybe it's different in a way that it's not better nor worse. What does it mean than?