I am trying to use the global optimisation toolbox to find some parameters which will make a computed curve overlay some experimental data. So I have two pieces of experimental data, t_data and V_data which I want to fit to and I have other sources of experimental data which I use in my function: I_app,SOC_a,SOC_c,OCV_c,OCV_a. I store the parameters I want to find in a colum vector, X. I define the function as follows:
fun = @(X,t_data)terminal_voltage(V_data,I_app,mu_n,t_data,X,SOC_a,SOC_c,OCV_c,OCV_a)';
I define a starting position X_0, and upper and lower bounds UB & LB. The mu_n is just some points I calculate offline. I ran the following code:
rng default % For reproducibility
gs = GlobalSearch;
problem = createOptimProblem('fmincon','x0',X_0,...
'objective',fun,'lb',LB,'ub',UB);
>> x = run(gs,problem);
and I received the following error:
Not enough input arguments.
Error in @(X,t_data)terminal_voltage(V_data,I_app,mu_n,t_data,X,SOC_a,SOC_c,OCV_c,OCV_a)'
Error in fmincon (line 546)
initVals.f = feval(funfcn{3},X,varargin{:});
Error in globalsearchnlp
Error in GlobalSearch/run (line 340)
globalsearchnlp(FUN,X0,A,B,Aeq,Beq,LB,UB,NONLCON,options,localOptions);
Caused by:
Failure in initial objective function evaluation. FMINCON cannot continue.
Failure in initial call to fmincon with user-supplied problem structure.
Any idea what's going on?