octave_lsode_sequentialreaction
Function: octave_lsode_sequentialreaction (k1, k2, x0, min, max)
d[A]/dt = −k1[A] d[B]/dt = k1[A] − k2[B] d[C]/dt = k2[B]
function xdot = f( x, t ) global gk1 global gk2 xdot(1) = - gk1 * x(1); xdot(2) = gk1 * x(1) - gk2 * x(2); xdot(3) = gk2 * x(2); endfunction function out = octave_lsode_sequentialreaction( k1, k2, x0, min, max ) global gk1 = k1; global gk2 = k2; gx0 = x0; t = linspace( min, max, 100 ); x = lsode( 'f' , gx0, t ); plot( t, x); out = [ t' x ] ; endfunction