Optimization of ODE parameters

4 次查看(过去 30 天)
Murad Nazari
Murad Nazari 2018-3-13
评论: Torsten 2018-3-13
I have a set of data experimental data and want to solve a differential equation with two unknown variable. Those two unknown variable should be tuned that the solution of ode will match the experimental data.I have written the following code but I couldn't move forward. Any help will be appreciated.
Thanks in advance.
load data.mat
expTime = Data (1:6,1);
Tr = Data (1:6,2);
tSpan = [0 10];
T0 = Data(1,2);
x = [10522;53555];
myfun = @(t,T) (5.4675e-4)*exp(-(x(1))/(8.314*T))*(x(2));
T = ode45 (myfun,tSpan,T0);
simY = deval(T, expTime);
A = [ 1 , 0];
b =1;
ab0 = [1 ;1];
x = lsqnonlin(@ObjFnc,ab0,0,15000)
In the following code I tried to write an objective function that takes input of two unknown variables, solves ODE, and calculates the error. I couldn't find a way how to calculate the error.
function cost = ObjFnc(a,b)
tSpan = [0 10];
load data.mat
T0 = Data(1,2);
expTime = Data (1:6,1);
myfun = @(t,T) (5.4675e-4)*exp(-a/(8.314*T))*b;
T = ode45 (myfun,tSpan,T0);
Tp = deval(T,expTime);
end
  1 个评论
Torsten
Torsten 2018-3-13
Take a look at our "reference code" for this kind of problem:
https://de.mathworks.com/matlabcentral/answers/43439-monod-kinetics-and-curve-fitting
Best wishes
Torsten.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Ordinary Differential Equations 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by