How can I optimize 2 parameters of my ODE system (with 3 deferential equation) to minimize distance between theorical and experimental value

1 次查看(过去 30 天)
Hello,
I want to develope a model in mathlab but i don't know how can i find best K and De (constant parameter) from my models to minimaze the sum of distance betwen theorical and expermental value of C.
Thanks you advance for your help.

采纳的回答

Bjorn Gustavsson
Bjorn Gustavsson 2020-5-27
编辑:Bjorn Gustavsson 2020-5-27
The way you've written the equations above only gives you 2 differential equations, in your odethreevariable function you code it as if the first equation was:
Either your odethreevariables function or your equations are correct, you'll have to decide which it is.
To solve this type of problems you can do something like:
K_De_0 = [1 1]; % Or a more appropriate start-guess
K_De_optimal = fminsearch(@(K_De) sum((C_B_obs-C_B_fcn(tC,K_De)).^2),K_De_0);
That is a standard least-square fit of your function C_B_fcn with parameters K_De evaluated at times tC (that should be the instances in time for which you have your estimates of C_B). The only thing you'll need to do is to integrate your ODEs inside C_B_fcn to get the C_B-curve, something like this:
function C_B = C_B_fcn(tC,K_De)
ICs=zeros(3,1);
ICs(1,1) = 0.0035;
ICs(2,1) = 0;
[t,X]=ode45(@(t,X) ode2variable(t,X,K_De),tC,ICs);
C_B = X(:,2);
end
function [dX_dt]=ode2variable(t,X,K_De)
% EDIT:
K = K_De(1);
De = K_De(2);
rc = X(1);
Cb = X(1);
rg = 0.0035;
Y0 = 182;
a = 190.47;
Jb = 1/((rg^2/(rc^2*(K*Y0)))+((rg*(rg-rc))/(rc*De)));
dX_dt = [-((Jb*(rg^2))/(Y0*rc^2)) ; Jb*a]; % ODE (system of 2 diferential equations)
end
This is not tested but should at least give you a starting point.
HTH
  4 个评论
Jeremy Brasseur
Jeremy Brasseur 2020-5-28
Yes perfectly ! I found De et K (Ke optimale =4.06824920654296e-07 et De optimal=5.72655059814452e-11) based on the K_De_0 = [10^-8 10^-12]. The answert is exactly that i wanted (similar at the literatur) :)
Thank you very much for your help :D

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 General Applications 的更多信息

产品


版本

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by