Failure in initial user-supplied objective function evaluation.
Show older comments
Hi I am a beginner in matlab. Hope that someone can help me with this problem. I am doing a function minimization. The function depends on three variables (say x(1),x(2),q). But I want the function to be optimized over the first two variables (x(1),x(2)) only. So, for each value of q I assign, I will do fmincon on the function
here is my fmincon command.
x0= [0.01;0.007];
options=optimset('Algorithm','active-set');
[x fval]=fmincon(@(x)calc(x,q),x0,[ 0.5 -1 ; -1 1 ],[ 0 ; 0 ],[],[],[0;0],[1;1],[],[],options);
where calc is my function.
The warning that I get is this
Warning: Trust-region-reflective algorithm does not solve this type of problem,
using active-set algorithm. You could also try the interior-point algorithm: set
the Algorithm option to 'interior-point' and rerun.
> In fmincon at 460
In prog at 22
??? Error using ==> @(x)calc(x,q)
Too many input arguments.
Error in ==> fmincon at 540
initVals.f = feval(funfcn{3},X,varargin{:});
Error in ==> prog at 22
[x fval] = fmincon(@(x)calc(x,q),x0,A,b,Aeq,beq,lb,ub,c,ceq,options);
Caused by:
Failure in initial user-supplied objective function evaluation. FMINCON
cannot continue.
Cannot find the problem with my fmincon command especially the "too many input argument" problem. can someone tell me what is the problem that can cause the Failure in initial user-supplied objective function evaluation?
Thanks in advance.
4 Comments
Oleg Komarov
on 28 Feb 2011
What is calc? A user defined function? If yes, post the code.
Sandoko
on 28 Feb 2011
Oleg Komarov
on 28 Feb 2011
And what do you need q for? It's not used within the fcn you pasted.
Sandoko
on 1 Mar 2011
Accepted Answer
More Answers (0)
Categories
Find more on Systems of Nonlinear Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!