Modelling consecutive chemical reaction (ode45, lsqcurvefit)

조회 수: 3 (최근 30일)
Marco Knobloch
Marco Knobloch 2018년 11월 21일
댓글: Marco Knobloch 2018년 11월 21일
Hello community
I want to model some experimental data with the ode's of the unimolecular consecutive chemical reaction to get the values of the kinetic konstants (k). The odes are:
I have experimental data to fit for I. To do so, I adopted the code from Star Strider in this post to my needs:
ydata = [1;5;5;2.5;3.96;2.37]; % Experimental data for I
xdata = [0;49.8000000000000;100.200000000000;150;199.800000000000;250.200000000000]; % time
B0 = [0.2 0.8];
lb = [0 0]
[B,Rsdnrm,Rsd,ExFlg,OptmInfo,Lmda,Jmat] = lsqcurvefit(@MonodKinetics2,B0,xdata,ydata,lb);
% Plot
a= MonodKinetics2(B, xdata)
plot(xdata, ydata,'bo')
hold on
plot(xdata,a,'ro')
hold off
function S = MonodKinetics2(B, t);
% k1 = B(1), k2 =(B2)
% A = x(1), I = x(2), P = x(3)
x0 = [1 1 0];
[T,Sv] = ode45(@DifEq, t, x0);
function dS = DifEq(t, x);
xdot = zeros(2,1);
xdot(1) = -B(1) .* x(1);
xdot(2) = B(1) .* x(1) - B(2) .* x(2);
xdot(3) = B(2) .* x(2);
dS = xdot;
end
S = Sv(:,1);
end
It is obvious that something is wrong, because the calculated values for I are always 1 and for the k's nearly 0. Can somebody help me?
  댓글 수: 2
Torsten
Torsten 2018년 11월 21일
If you have data for I, you'll have to set S = Sv(:,2) instead of S = Sv(:,1).
Marco Knobloch
Marco Knobloch 2018년 11월 21일
Oh that's it!! It is more obvious than I thought. Thank you Torsten

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Chemistry에 대해 자세히 알아보기

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by