Global optimization of parameters in ode
1 view (last 30 days)
Show older comments
Hi
I want to fit the solution of differential equation
dy/dt= -ay-by^2-cy^3
to my experimental data to optimize globally constants a, b and c .
I have used lsqcurvefit to do show but I cannot get these values of constant matching with the earlier values so I need to fit them globally by using Genetic algoritm.
How can I define the fit function (objective function)??
Here is the code I have so far.
% % % % % % % % experimental values
A=load('data.csv');
time=(A(1,150:end));
B=(A(691,150:end))';
data=B./min(B);
plot(time,data,'or')
% % % % % % % % % % Solving the differential equation and plotting experimental data vs solution of ode
tspan = [0 3000];
y0 = 1;
y01=1;
a=0.001;b=0.001;c=0.0001;
[t,y] = ode45(@(t,y) -a*y^3-b*y^2-c*y, tspan, y0);
plot(time,data,'or','Markersize',2)
hold on
plot(t,y,'-k','Color','magenta')
hold off
xlim([0 3000]);
legend('data','ode45')
0 Comments
Answers (0)
See Also
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!