Hello all,
I have a system consisting of 4 ODEs, which I call sys (incl. initial conditions). The parameters are called par1, par2, par3. My data consists of a time series of measurements (from time 0 to 100), which represents the sum of the last two solutions (sol3, sol4) of the ODE system.
For fitting the model to this kind of data, I did the following:
(* Numerical solution *)
model[par1_, par2_, par3_] := model [par1, par2, par3] = Module[{nsol, sol1, sol2, sol3, sol4, t},
nsol = NDSolveValue[{sys}, {sol1, sol2, sol3, sol4},{t,0,100}, MaxSteps->10000];
Return[nsol];
]
(* Relevant solution part *)
modeldata[par1_?NumericQ, par2_?NumericQ, par3_?NumericQ] := Total[Through[Part[model[par1, par2, par3], 3:4][t]]];
(* Fitting *)
nlm=NonlinearModelFit[data, modeldata[par1, par2, par3], {par1, par2, par3}, t, Method->"NMinimize"];
Problem:
Mathematica complains about the Interpolating Function: Input value lies outside the range of data in the interpolating function. Extrapolation will be used.
I really do not see where the problem lies. Indeed, the data range should be covered by the InterpolatingFunction since the integration covers the relevant range.
Thanks for any advice.