Parameters estimation for a System of differential equations, gives error

8 ビュー (過去 30 日間)
Miguel Figueroa
Miguel Figueroa 2019 年 12 月 10 日
編集済み: Miguel Figueroa 2019 年 12 月 10 日
Hello everybody, I'm a student really struggling with this college assignment. I'm trying to estimate the parameters needed to fit my experimental data to a model of two differential equations of the form:
79098888_434064167269466_3952312455778009088_n.png
I have a set of experimental data for my measured value y, [FeOOH] and [O_3], and obviously time while x is just a variable that came up during the modelling and doesn't have experimental data. However, it's solvable at everypoint after evaluating all the experimental data. I found several similar examples in here, such as:
Following the advice of @Star Strider, that answered both problems, curiously. My adjustable parameters are those k's you see and the alphabetical letters like a,b,c,f,g,h, etc. I have 84 experimental values for each variable. I literally copied my equations in the sintax he used for the first link and I get the following error:
I'm attaching my code, please run it and see the error, it says the matrix Index exceeds dimensions for the differential equation of dx/dt. I have a hunch that it might be about the number of parameters I'm using is not the number of parameters I'm generating for my initial guess, I considered 18 but I'm gonna recount. If anyone finds it possible to run please comment!
  3 件のコメント
Miguel Figueroa
Miguel Figueroa 2019 年 12 月 10 日
編集済み: Miguel Figueroa 2019 年 12 月 10 日
Hello, sir Star Stride. Thank you very much for your input. I would like to clarify some things in hopes that we can come up with an answer. First, of the two differential equations I'm only trying to fit one 'c', which is c(2), which represents concentracion of a compound called DCF. The first differential equation for c(1) is a just function that gives me a value of a factor called [OH] that is present in the ODE for DCF (c(2)), but it's not something I want to fit, because it's not physically possible to measure it. So, following your work for the Monoid kinetic problem, you did something similar: two ODE's in which you only have real data for the second variable and use the data to find a value for y(1) that is later used for y(2). I tried to replicate that idea here. The other two ODE's (dcdt(3) and dcdt(4)) were just me trying to follow the same template of the Igor_Moura code, since he had to fit data for 4 variables, but since I only had to do it for one, I made them equal to 0.
About the discontinuities, I made 9 experiments, so I would have 10 data sets, one for time and 8 sets of c(2).Does that mean I can only fit 9 parameters and not more? The other two variables (FeOOH) and (O_3) are also independent variables that affect c(2), but they were kept constant for each data set, albeit with different values. I didn't know how to best represent that. So each data set looks like this:
t: from 0 to 20 minutes.
DCF: from y0 to final value at 20 minutes.
FeOOH: Constant value, but different for each experiment.
O_3: Constant value, but different for each experiment.
How should I introduce those 10 data sets to my function, then? In order for the lsqcurvefit to go through each of them. I see it's not alright to just mash them all together in two columns.
And finally, about the constants, I also made a slip up there, after counting thoroughly, I noticed I used an old expression that was made up of 18 constants, but now I've reduced to 14, I will try to reduce it even further
%theta(1) = k_o3; theta(2) = k_oh; theta(3) = k_18; theta(4) = k_9;
%theta(5) = k_-9; theta(6) = k_4: theta(7) = k_6; theta(8) = b; theta(9) =
%f; theta(10) = j; theta(11) = a; theta(12) = e; theta(13) = g; theta(14) = h
I'm gonna try to fix it up as much as possible and link it here. Maybe I can make it work. I was desperate and your solutions were so similar to mine I thought it would just work. I'm sorry.
Edit: So I've just noticed I'm an idiot. I don't have 14 constants. I only have 8, but during my derivation of the model they were so scary looking that I transformed to alphabetical letters and ended up with double that. Here's what each letter there meant, so I'm gonna fix that and see if it works now:
Sin título.png
Miguel Figueroa
Miguel Figueroa 2019 年 12 月 10 日
編集済み: Miguel Figueroa 2019 年 12 月 10 日
I've come back with an update. I have tried to find my own way of solving the problem and tried using the function fminsearch. I also tried to fit just the first set of parameters, this one:
t = [ 0 4 8 12 16 20]
DCF = [ 0.054768223996110 0.052379215797507 0.048236017126572 0.018099058578819 0.006820913867391 0.002853303078191]
FeOOH = [ 9.003939223410242 9.003939223410242 9.003939223410242 9.003939223410242 9.003939223410242 9.003939223410242]
O_3 = [ 0.066666666666667 0.066666666666667 0.066666666666667 0.066666666666667 0.066666666666667 0.066666666666667];
And although the script runs without erros and gives me a sum of squared of errors of 0.014 approx. I get the following plot:
My function drops down at t= 0 and then follows a straight line. How is this possible, if the parameters I used give an error of just 0.014? Attached is the script.

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeHistorical Contests についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by