Optimization via an Integral
이전 댓글 표시
Hey there, I would like to maximize a function W=5*si0-int(r0,0,si0*n0), where si0 and n0 are the decision variables and r0=(n0*si0)^2. Constraints are just nonnegativity of si0 and n0. Script copied from the editor:
function W=kiratest;
syms si0
syms n0
r0=(n0*si0).^2
W=-(5.*si0-int(r0,0,si0*n0));
I already tried fmincon and linprog, but I always get several errors, such as:
>> fmincon(@kiratest,[0 0],[-1 0;0 -1],[0;0])
Warning: Trust-region-reflective algorithm does not solve this type of problem,
using active-set algorithm. You could also try the interior-point or sqp
algorithms: set the Algorithm option to 'interior-point' or 'sqp' and rerun. For
more help, see Choosing the Algorithm in the documentation.
> In fmincon at 472
??? Error using ==> kiratest
Too many input arguments.
Error in ==> fmincon at 590
initVals.f = feval(funfcn{3},X,varargin{:});
Caused by:
Failure in initial user-supplied objective function evaluation. FMINCON cannot
continue.
AND:
>> linprog(@kiratest,[-1 0;0 -1],[0;0])
??? Error using ==> linprog at 132
LINPROG only accepts inputs of data type double.
Please help me find the mistake or else another solution for optimization. Sincerely, Kira
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Solver Outputs and Iterative Display에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
