Fmincon is giving error
Show older comments
Hi! I am trying to minimise a self-written objective function called optim_caps using patternsearch method And it is giving me this error .
Not enough input arguments.
Error in optim_caps (line 40)
[t,C] = ode23tb(@equations6,(0:tfinal),Cinit,options,para_cap,time_Flpurge_exp,Flpurge);
Error in funevaluate (line 54)
f = feval(FUN,reshapeinput(Xin,X),varargin{:});
Error in poptimfcnchk (line 23)
[y,count,cache] = funevaluate(FUN,Xin,X,'init',cache,[],[],objFcnArg{:});
Error in patternsearch (line 262)
[Iterate,OUTPUT.funccount] = poptimfcnchk(FUN,nonlcon,X0,Iterate, ...
Error in capillary_model_complete_recycling_calibration_model (line 38)
[para_cap,fval,exitflag,output]=patternsearch(@optim_caps,initial,[],[],[],[],lb,ub,[])
Caused by:
Failure in initial user-supplied objective function evaluation. PATTERNSEARCH cannot continue.
This is the declaration of my objective function. para_cap are the paramemters that I want to optimize, and the rest are just input
function ff =optim_caps(para_cap,Cgout_exp,CO2_exp_gm3,time_exp,time_exp_CO2,time_Flpurge_exp,Flpurge)
Inside my objective function I solve a ODE system and this is the declaratino of the ODE
[t,C] = ode23tb(@equations6,(0:tfinal),Cinit,options,para_cap,time_Flpurge_exp,Flpurge);
Equations6 is where I define my differential equations, and this is the definition of it:
function dC=equations6(t,C,para_cap,time_Flpurge_exp,Flpurge)
My question is, there is any specific data that should I extract from the patternsearch method that I am not feeding to my ODE solver? I feel I am missing some understanding on the syntaxis of the patternsearch.
Accepted Answer
More Answers (0)
Categories
Find more on Surrogate Optimization 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!