How to implement MultiStart to find a good fit of two curves at the same time with real data such as our curves are governed by an ODE system?
% Set up the problem for MultiStart
problem = createOptimProblem(‘lsqcurvefit’,’x0′,k0,’objective’,@simulatedhs,…
‘lb’,zeros(size(k0)),’xdata’,tforward ,’ydata’,[Hdata,HSdata] );
ms = MultiStart;
[k,fval,Exitflag,Output,Solutions] = run(ms,problem,50);
simulated_data = simulatedhs(k,tforward);
X=simulated_data(:,1);
Z=simulated_data(:,2);
%plot the result
figure(5)
plot(tforward,Hdata ,tforward,X)
plot(tforward,Hdata,tforward,Y)
legend(‘Data’,’Fitted result’)% Set up the problem for MultiStart
problem = createOptimProblem(‘lsqcurvefit’,’x0′,k0,’objective’,@simulatedhs,…
‘lb’,zeros(size(k0)),’xdata’,tforward ,’ydata’,[Hdata,HSdata] );
ms = MultiStart;
[k,fval,Exitflag,Output,Solutions] = run(ms,problem,50);
simulated_data = simulatedhs(k,tforward);
X=simulated_data(:,1);
Z=simulated_data(:,2);
%plot the result
figure(5)
plot(tforward,Hdata ,tforward,X)
plot(tforward,Hdata,tforward,Y)
legend(‘Data’,’Fitted result’) % Set up the problem for MultiStart
problem = createOptimProblem(‘lsqcurvefit’,’x0′,k0,’objective’,@simulatedhs,…
‘lb’,zeros(size(k0)),’xdata’,tforward ,’ydata’,[Hdata,HSdata] );
ms = MultiStart;
[k,fval,Exitflag,Output,Solutions] = run(ms,problem,50);
simulated_data = simulatedhs(k,tforward);
X=simulated_data(:,1);
Z=simulated_data(:,2);
%plot the result
figure(5)
plot(tforward,Hdata ,tforward,X)
plot(tforward,Hdata,tforward,Y)
legend(‘Data’,’Fitted result’) parameter estimation, curve fitting, multistart, oprimization, global minimum MATLAB Answers — New Questions