How to stop fminsearch when objective function exceeded certain value (minima or maxima)
options = optimset('MaxFunEvals',9999);
[x,fval,exitflag,output] = fminsearch(@(var)objectiveFunction(variables), changingParameters,options);
How to stop the function if I reach certain objective function value (for example 1000) [within the 9999 iterations]
I've tried 'TolFun'
, I am not sure if this is correct
options = optimset('MaxFunEvals',999,'TolFun',1000);
[x,fval,exitflag,output] = fminsearch(@(var)objectiveFunction(variables), changingParameters,options);