Failure in initial user-supplied objective function evaluation.
이전 댓글 표시
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
Oleg Komarov
2011년 2월 28일
What is calc? A user defined function? If yes, post the code.
Sandoko
2011년 2월 28일
Oleg Komarov
2011년 2월 28일
And what do you need q for? It's not used within the fcn you pasted.
Sandoko
2011년 3월 1일
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Systems of Nonlinear Equations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!