Solving a system of differential equation numerically but with constants
Show older comments
Hello,
I am asking this question before I buy MATLAB to make sure that I can get a solution of a problem (so that I won't be wasting money). I have never used MATLAB before.
I am currently needing a numerical solution to a system of differential equation for a certain phenomenon I am currently working on. However, the problem is when I look through google, most question involves a system of differential equation with constants that are defined apriori (like 3*x^2 instead of a*x^2). I am using the system of differential equation to fit certain experimental data I have achieved so that I can figure out the constants that have important meaning to the phenomenon. Therefore, I have no idea what value the constants take.
The system of differential equation I have set up looks like this:
w(t) = a*exp(-t/b)
dx(t)/dt = c*w(t) + d*y(t) + e*z(t) - (1/f)*x(t)
dy(t)/dt = g*x(t) + h*y(t) + i*z(t) - (1/j)*y(t)
dz(t)/dt = k*x(t) + l*y(t) - (1/m)*z(t)
where x(0) = y(0) = z(0) = 0, dx(0)/dt = dy(0)/dt = dz(0)/dt = 0, and all the constants from a to m is above 0.
There are four differential equation and four yet-to-be-known equation, so I think this is theoretically solvable. However, each equations are recursive (am I using this term right?) and I cannot do this by hand and nor could a freeware software that tried to solve this analytically.
I am expecting a solution where each equation consists of variable (t) and constants combined in an arithmetic way. Is this possible in MATLAB?
I really have no background in mathematics. Even worse, I learned almost everything in Japanese so I do not know the correct translation of tehcnical terms. Also, my English is mediocre at most. I apologize for my inability to effectively explain what I am trying to explain.
Thank you.
10 Comments
Torsten
on 13 Oct 2015
In principle it is possible with MATLAB.
You will have to couple a solver for ordinary differential equations (e.g. ODE15s) with a nonlinear least-squares solver (e.g. LSQCURVEFIT from the optimization toolbox).
The nonlinear least-squares solver suggests values for your constants, the ODE solver returns the solution at the times where you have data from your experiments for these constants, the nonlinear least-squares solver tries to adjust the constants such that x, y and z better meet your experimental data and so on in an iterative fashion.
Take a look at
http://www.mathworks.com/matlabcentral/answers/43439-monod-kinetics-and-curve-fitting
where a similar problem has been discussed.
But parameter fitting problems are inherently difficult. Nobody can guarantee that MATLAB (or any other code) will produce good results. Much depends on your experimental data and whether your model is adequate or not.
I suggest you try a MATLAB test version.
I heard that TOMLAB is especially suited for parameter fitting problems, but I myself don't have experience with it.
What makes me wonder in the formulation of your mathematical problem is that you prescribe six boundary conditions for three ordinary differential equations. This does not seem to make sense to me. Think about your problem formulation before you start with numerical computations.
Best wishes
Torsten.
Torsten
on 13 Oct 2015
By the way:
If you write the equation for w as
dw/dt = -1/b*w(t),
you get a linear system of 4 ODEs with constant coefficients which can be solved analytically.
Best wishes
Torsten.
Torsten
on 13 Oct 2015
The solution is "simply" exp(A*t) where A is the coefficient matrix:
Best wishes
Torsten.
Torsten
on 13 Oct 2015
The matrix exponential of a (4x4) general matrix will be a lengthy expression and it will involve the roots of a polynomial of degree 4.
Take a look at
for a solution.
Best wishes
Torsten.
Hayao
on 14 Oct 2015
Torsten
on 14 Oct 2015
I think there is no need to simplify your model.
Solving your problem numerically, your constants will always be definite numbers. So a simple call to MATLAB's matrix exponential as expm(A*t) will solve your ODE system.
The solution in MATHEMATICA only looks so complicated because the entries of the matrix are given as arbitrary parameters.
Best wishes
Torsten.
Hayao
on 14 Oct 2015
Torsten
on 14 Oct 2015
Yes, of course a,b,c,.. are unknowns, and they will change during the computation until the best fit for your model is reached. But if you solve your problem with MATLAB, a,b,c,... will always be (changing) numerical values such that you apply the matrix exponential to a matrix with definite numbers as entries, not to a symbolic matrix with letters as entries.
Best wishes
Torsten.
Answers (1)
Gajendra Singh
on 25 Jul 2019
0 votes
Do you find any solution?? Actually i have same problem ( four differential equation with 4 unknown variable and 4 unknown constant which have to be optimize)
Categories
Find more on Symbolic Math Toolbox 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!