Reputation: 1
theta=[60,100,-50,60,100,-50,-1.5,-0.74,1.5,0,0];
lb=[-500*ones(1,6),-2.25,-3,2,0,0];
ub=[500*ones(1,6),-0.75,0,2.6,0.3,0.2];
problem=createOptimProblem('fmincon','objective',Optim_obj_fun,'x0',theta,'lb',lb,'ub',ub,'options',optimset('Algorithm','SQP','Disp','none'));
gs=GlobalSearch;
[theta_result,f]=run(gs,problem);
%In function.m
function f=Optim_obj_fun(a,b,c,d,e,f,g,h,i,j,k);
I get the error: 'Insufficient number of parameters entered'
Upvotes: 0
Views: 68
Reputation: 35525
From the documentation (emphasis mine):
Function handle to the objective function. For all solvers except lsqnonlin and lsqcurvefit, the objective function must accept a vector x and return a scalar. [...]
Your function does not accept a single vector x
but many values. Just change the function so all those values are input as a vector, you can unpack them into variables inside.
You are also missing an @
, as @Cris Luengo says.
Upvotes: 1