344 views (last 30 days)

Hello. Ok, so I'm new to matlab and I've got a question regarding parameter estimation for a kinetic model. I have 4 different reactants and their concentrations are c1, c2, c3 and c4. I also have 4 differential equations, each one related to a concentration (c1, c2, c3 and c4, respectively -see below-) and experimental data for all these concentrations on 12 different times plus the initial condition. The k's are the rate coefficients. I want to solve this system of ODE's using ode45 and then use the output to compute the experimental data minus the observed data and use these results to estimate the values of k's using lsqnonlin, but apparently I can't solve these ODE's without numerical values for k -which is what I want to know-. Any help on how to set up the command to solve this?

function dcdt=batch(t,c,k)

dcdt=zeros(4,1);

dcdt(1)=-k(1)*c(1)-k(2)*c(1);

dcdt(2)= k(1)*c(1)+k(4)*c(3)-k(3)*c(2)-k(5)*c(2);

dcdt(3)= k(2)*c(1)+k(3)*c(2)-k(4)*c(3)+k(6)*c(4);

dcdt(4)= k(5)*c(2)-k(6)*c(4);

end

Data:

t c1 c2 c3 c4

0 1 0 0 0

0.1 0.902 0.06997 0.02463 0.00218

0.2 0.8072 0.1353 0.0482 0.008192

0.4 0.6757 0.2123 0.0864 0.0289

0.6 0.5569 0.2789 0.1063 0.06233

0.8 0.4297 0.3292 0.1476 0.09756

1 0.3774 0.3457 0.1485 0.1255

1.5 0.2149 0.3486 0.1821 0.2526

2 0.141 0.3254 0.194 0.3401

3 0.04921 0.2445 0.1742 0.5277

4 0.0178 0.1728 0.1732 0.6323

5 0.006431 0.1091 0.1137 0.7702

6 0.002595 0.08301 0.08224 0.835

Thanks in advance!

Star Strider
on 1 Dec 2016

si heon Seong
on 4 Feb 2021 at 8:33

Dear @Star Strider

I really appreciate your help! Can I ask the last one?

I have a model of 6 coupled differential equations for c1, c2, c3, c4, c5 and c6

but there are only two data set for c1 and c2

Can I still do the fitting job?

Always thank you

Star Strider
on 4 Feb 2021 at 12:38

si heon Seong — You can only fit ‘c1’ and ‘c2’ to your data, so in ‘kinetics’:

C = Cv(:,1:2);

(assuming that ‘c1’ and ‘c2’ are the first 2 differential equations in your system).

There have to be more data (more rows in the data matrix and time vector) than there are parameters to estimate.

My pleasure!

Khoi Ly
on 21 Feb 2021 at 15:40

I was directed by your answer in another post regarding a similar problem.

In that post, I was trying to estimate the parameters of the differential equations using more than one time series data sets.

In the example above, given.

t=[0.1; 0.2; 0.4; 0.6; 0.8; 1; 1.5; 2; 3; 4; 5; 6];

c=[0.902 0.06997 0.02463 0.00218

0.8072 0.1353 0.0482 0.008192

0.6757 0.2123 0.0864 0.0289

0.5569 0.2789 0.1063 0.06233

0.4297 0.3292 0.1476 0.09756

0.3774 0.3457 0.1485 0.1255

0.2149 0.3486 0.1821 0.2526

0.141 0.3254 0.194 0.3401

0.04921 0.2445 0.1742 0.5277

0.0178 0.1728 0.1732 0.6323

0.006431 0.1091 0.1137 0.7702

0.002595 0.08301 0.08224 0.835];

we can estimate the parameters theta. Since the example above uses only one data set, what should I do if I have multiple data sets? Can I just concatenate the time-series data sets together and run the lsqcurvefit as usual?

Also, in my problem, each different time-series data set contains a different initial value. How do I modify the example to allow for different initial values depending on the chosen time-series data set?

Thank you

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

Start Hunting!
## 7 Comments

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/314965-parameter-estimation-for-a-system-of-differential-equations#comment_742395

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/314965-parameter-estimation-for-a-system-of-differential-equations#comment_742395

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/314965-parameter-estimation-for-a-system-of-differential-equations#comment_742465

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/314965-parameter-estimation-for-a-system-of-differential-equations#comment_742465

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/314965-parameter-estimation-for-a-system-of-differential-equations#comment_742466

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/314965-parameter-estimation-for-a-system-of-differential-equations#comment_742466

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/314965-parameter-estimation-for-a-system-of-differential-equations#comment_742701

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/314965-parameter-estimation-for-a-system-of-differential-equations#comment_742701

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/314965-parameter-estimation-for-a-system-of-differential-equations#comment_843705

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/314965-parameter-estimation-for-a-system-of-differential-equations#comment_843705

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/314965-parameter-estimation-for-a-system-of-differential-equations#comment_1239478

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/314965-parameter-estimation-for-a-system-of-differential-equations#comment_1239478

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/314965-parameter-estimation-for-a-system-of-differential-equations#comment_1240043

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/314965-parameter-estimation-for-a-system-of-differential-equations#comment_1240043

Sign in to comment.