Using multistart to estimate non linear ode model parameters

2 views (last 30 days)
I am trying to fit some data to a nonlinear ODE system in order to estimate model parameters. But the fit I obtain is extremely sensitive to the initial guess and often I get as
Local minimum possible.
lsqcurvefit stopped because the size of the current step is less than the default value of the step size tolerance.
So, I thought may be use a MultiStart approach to find the global minimum as I don't know if I am getting the global minimum because sometimes if I use a different initial guess I get a better fit.
This is the code I have written for MultiStart.
%'time' is xdata and 'data' is ydata
x=[time,data];
[fit,fval]=fmincon(@(parameters)sumofSq(parameters,x),initial,[],[],[],[],lb,ub,[]);
%multistart problem
problem=createOptimProblem('fmincon','x0',initial,'objective',@(parameters)sumofSq(parameters,x),....
'lb',lb,'ub',ub);
%Find a global solution using MultiStart with 50 iterations
ms=MultiStart('PlotFcns',@gsplotbestf);
[xmulti,errormulti]=run(ms,problem,50)
function SSE=sumofSq(parameters,x)
time=x(:,1);
data=x(:,2);
fitted=model(parameters,time);
error=fitted-data;
SSE=sum(error.^2);
end
function output= model(parameters,thours)
x0=[2000,0];
[time,res] = ode45(@Eqn,thours,x0,options);
function s=Eqn(t,y)
%non linear model equations
a=10^6;
p=0.04;
k=10^5;
s(1)=(parameters(3)*y(1))*(1-(y(1)/k))-parameters(1)*y(4)*y(1);
s(2)=parameters(3)*(a-y(4))*y(1)-p*y(4);
end
output=res(:,1);
end
When I run this I get as
Initial point is a local minimum that satisfies the constraints.
Optimization completed because at the initial point, the objective function is non-decreasing
in feasible directions to within the default value of the optimality tolerance, and
constraints are satisfied to within the default value of the constraint tolerance.
But, the objective function value (sum of squared errors) is so high with 86, where as if I use normal
lsqcurvefit
without using (multiStart), and for the chosen initial guess I get the objective function values as 3.08.
So, what I am trying to do is to find a good fit and as it depends on initial guess I don't know if I can find a better fit than what I have at the moment. Because of that I used MultiStart but it gives a much higher objective function value. So, how can I get rid of this problem and find a better fit
This is the first time that I have tried out MultiStart. can someone please let me know if I have implemented it correctly so that it actually uses MultiStart and if it can overcome the issue of sensitivity to initial guess.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!