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!