Menu

#6 Octave Module's Resulting Code Structure split

None
open
nobody
Octave (1)
5
2017-04-19
2017-04-19
Anonymous
No

Hi,
I think that the Octave Code could be structured in a more useful way:
A function that calculates the reaction fluxes and collects them in the vector "Flux", given an arbitarray parametrisation, which is necessary for parameter estimation:
function Flux=ModelFlux(x,t,p)
A second function calculates the right hand side of the ODE, using those fluxes, and possibly additional parameters, if necessary:
function xdot=ModelRHS(Flux,p)
then define f and use it like this:

p=get_model_parameters();
x0=get_model_init();
f=@(x,t) ModelRHS(ModelFlux(x,t,p))
lsode(f,x0,t=linspace(0,T,n));
This will perhaps not be as fast as hard-coding everything but a lot more useful for optimisation purposes.

Analytically calculating the jacobian and parameter derivative would be a nice feature as well, as lsode runs better if you supply a jacobain function:

lsode({f,J},x0,t);

It's generally not great that the fluxes are never collected in a vector I think.
All the Best,
Andrei

Discussion

MongoDB Logo MongoDB