MATLAB: Solving Coupled Differential Equations

differential equationsMATLABode

For my problem I have two differential equations. These are:
dx/dt = -xp + yq + (1-x-y)q
dy/dt = -yq + (1-x-y)u
For my problem I have a given set of historical data and my objective is to find the best values for p,q & u to give the best fit to this historical data. I have a column of historical data related to each equation above. I also need to find the best initial conditions for each equation.
So far I have attempted to use For loops for each of p,q&u in order to find the best values compared with my data.
My problem is that I am not too sure on how to code this correctly. If anybody could help me make a start that would be great. I understand the general idea but am unsure of how to carry this out in Matlab

Best Answer

If you are fitting a system of differential equations to data, see Monod kinetics and curve fitting. It uses estimated parameters to define the initial conditions as well as fit the data. It should be straightforward to adapt it to your problem.