Rate constant estimation and optimization (ODE)

3 ビュー (過去 30 日間)
m changmai
m changmai 2020 年 1 月 10 日
回答済み: Alan Weiss 2020 年 1 月 10 日
I am totally new to matlab coding. I have written a code on a simple ODE "dCdt=-k1*CS*CH". I want to find the 'k' value and optimize it such that the error between my experimental and calculated concentration values is low. The code runs, but it accepts all the initial guess 'k' values. How should I find my actual 'k' value.
function SSE=myobjective(C,CS)
err=C-CS;
SSE=sum(err.^2)
k1=.001;
tspan=linspace(1,5,6);
CS0=2;
CH=1;
CS=[1.8 .78 .40 .16 .071 .022]';
[t,C]=ode45(@(t,CS) funcatalyst(t,CS,CH, k1),tspan,CS0)
options=optimset('display','iter','largescale','off','maxiter',10000,'maxfunevals',10000);
[k, fval,exitflag,output]=fminsearch(@(k) myobjective(C,CS), k1, options)

回答 (1 件)

Alan Weiss
Alan Weiss 2020 年 1 月 10 日
You might find this example or this example to be relevant.
Alan Weiss
MATLAB mathematical toolbox documentation

カテゴリ

Help Center および File ExchangeOrdinary Differential Equations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by