#
#octave_lsode_sequentialreaction.m
#https://ix86.org/octave/index-main.html?octave_lsode_sequentialreaction
#
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
