Info

This question is closed. Reopen it to edit or answer.

How to check data fit of differential equations

1 view (last 30 days)
David
David on 29 May 2015
Closed: MATLAB Answer Bot on 20 Aug 2021
I'm quite illiterate in Matlab, using previously written code, so please bear with me.
Using a genetic algorithm, I have solved four differential equations, (for four different experiments), for 11 parameters (stored as par.alpha, par.beta, ...)
Now my GA spit out a fitness value (fvalN) at the end, but I need to find the R^2 fit of this to the data without running the whole GA again. I am going to manually mess with the parameters to check which ones the model is most sensitive too. In another post of mine it was recommended I use norm(dy) but I'm not sure how to go about this.
My equations are in WTTNF.m:
function dy = WTTNF(~,y,par)
dy = zeros(4,1);
dy(1) = par.alpha*y(1)*(1-y(1)/y(4))-par.beta*y(1)-par.gamma*y(3)*y(1);
dy(2) = par.beta*y(1)+par.zeta*par.gamma*y(3)*y(1)-par.delta*y(2);
dy(3) = par.theta*y(2)+par.epsilon;
dy(4) = par.eta_c*y(3)*y(1)+par.eta_h*y(3)-par.psi*y(4)*(y(4)/par.Ko)^2;
How do I check the fit of this data with what is stored in the value "data," i.e.
>> data
data =
t: [0 1 2 3 6 8]
val: [4x6 double]
To further complicate things, I have four different cases where various parameters are inactive and I need to get the fit for all of them. But one thing at a time.
-Dave K

Answers (1)

Star Strider
Star Strider on 29 May 2015
I would use your currently estimated parameters (as the initial parameter estimates) and the sort of procedure outlined in Monod kinetics and curve fitting, but using nlinfit or fitnlm (instead of lsqcurvefit), and the Statistics Toolbox functions to get statistics on the parameters and fit.

Community Treasure Hunt

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

Start Hunting!