Fit parameters using ODE 45 and 1 differential equation
Show older comments
Hello,
I'd like to fit one single differential eq which is dv/dt = (alpha * beta * caa(t)) *v(t)
I have attempted to find a solution on how to fit this differential equation with some data that I've got but I didn't succeed. I have uploaded my 2 files here that I use for my fit. I'd like to find alpha and beta and the rate of change of the volume as a fonction of time. I know the concentration caa for each day of each time t.
I was thinking that maybe I should divide this eqt into 2 diff equations ?
Thanks in advance,
8 Comments
Star Strider
on 11 Jan 2020
I was thinking that providing ‘Caa’ would allow us to run your code!
Cannot do anything without it.
hna
on 11 Jan 2020
hna
on 12 Jan 2020
David Goodmanson
on 13 Jan 2020
Hi hna,
To run 'injection' would require a few input parameters, not yet supplied.
Caa2 has V as one of its inputs. Is that the same as the v in the differential equation, so that Caa depends on v, or is V a constant so that Caa is independent of v?
It doesn't appear that
volume(1)=(param(1)-param(2))*Caa(t)*volume(1);
from ‘fit’ is consistent with
dv/dt = (alpha * beta * caa(t)) *v(t)
from the question statement. Is
dv/dt = (alpha + beta*caa(t)) *v(t)
perhaps what is intended?
David Goodmanson
on 13 Jan 2020
Hi hna,
what are the values of t that go along with the values of caa?
hna
on 13 Jan 2020
David Goodmanson
on 15 Jan 2020
Hi hna,
If you temporarily take away caa from the equation, the result is
v = v0*exp(a*t) or log(v) = log(v0) + a*t
so the plot of log(v) vs t is a straight line. Looking at your data, that's approximately what you get, so unfortunately the data may not be very favorable for finding a constant b that depends on caa.
Since caa(t) is an independent function of time and does not depend on v, the solution to the full equation is
log(v) = a*t + b*Integral{t0,t}caa(t')dt' + C
In the data, the first point v=0 has to be excluded because of the log, but that still leaves 24 points, in which case t0 would be 7. You can do the integral numerically, for example with some interpolation and then cumtrapz. Denoting the integral by Icaa, the solution is simply
abc = [t Icaa ones(size(t))]\log(v)
a = abc(1)
b = abc(2)
c = abc(3)
where t,Icaa and v are all column vectors. I tried this with several other choices for a starting point in the data, and also with smoothing and interpolating v first, but did not come up with a useful result. The value of b comes out negative occasionally but not in any consistent way. It is not so clear that caa is having much of an effect.
Answers (0)
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!