Solving Multiple First Order Differential Equations for Constants

Capture.PNG
Hi,
I hope someone can help me.
I am looking to solve these 6 first order differential equations for the unknowns k1, k2, k3, k4, k5 and k6, with known concentrations in the square brackets (any number for them will do just now to get a working script!). Could someone help me obtain a script to do this?
Many thanks in advance.

 採用された回答

Torsten
Torsten 2019 年 2 月 15 日

1 投票

Replace the time derivatives by difference quotients.
Then you get a linear system of equations
A*[k1;k2;k3;k4;k5;k6] = b
where the number of rows in A is equal to (6*number of measurement times).
This can subsequently be solved using
k = A\b.
Best wishes
Torsten.

8 件のコメント

HK
HK 2019 年 2 月 15 日
Thank you very much!
I am still slightly confused though. Is there any chance you could type out some of the script? I think that would help me understand a lot better.
Thanks again
Torsten
Torsten 2019 年 2 月 18 日
Which data from measurements do you have ?
HK
HK 2019 年 2 月 18 日
I know all the values in moles or mass for the quantities in the square brackets, eg. [MeOH] = 1.412 moles.
Thanks again so much
Torsten
Torsten 2019 年 2 月 18 日
Ok. Then for [TG], e.g., you can use the equations
[TG]_(i+1) - [TG]_(i) = dt * (-k1*[TG]_(i+1)*[MeOH]_(i+1) + k2*[DG]_(i+1)*[ME]_(i+1))
for i=1,2,...,N.
Same for the other components.
You see that you get a linear system of equations in the unknowns k1,k2,...,k6, as stated above.
This can be solved using the mldivide - operator.
HK
HK 2019 年 2 月 18 日
Slowly but surely I think I am getting somewhere! (Sorry I am inexperienced with Matlab and trying to improve).
Can you identify the errors that I still have? Am I solving for k in the command window correctly? All of the equations for 'TG(i+1) - TG(i)' etc are in correctly but there are errors around the equals signs saying 'Parse error at '=': usage might be invalid MATLAB syntax'.
Capture2.PNG
Torsten
Torsten 2019 年 2 月 20 日
編集済み: Torsten 2019 年 2 月 20 日
To get approximate values for k1,...,k6, you need measurement data for the concentrations [TG], [DG],,...,[MeOH] at different times t1,...,tn, not only at t=0. Do you have such data ?
HK
HK 2019 年 2 月 20 日
Yes, I have concentration data at the end of the reaction (t=60 mins/3600s) and also at two intermediate times (t = 2 mins/120s and t = 12 mins/720s). Should I state all of these values at the top of the script like I did for the values at t=0? Should the script then run or do additional changes need to be made in its layout?
Thanks again!
Torsten
Torsten 2019 年 2 月 20 日
Since your data are taken at times with such a great temporal distance, you should try the method described here:
Best wishes
Torsten.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeGet Started with Curve Fitting Toolbox についてさらに検索

質問済み:

HK
2019 年 2 月 15 日

コメント済み:

2019 年 2 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by