%
% Example 3.7: Simple Biological Reactor
%
% - constant volume
% - well mixed
% - Monod kinetics
%
% Bob Newell, March 1996
%
%-----------------------------------------------------------
% parameters
muhat = 5;
Kn = 20;
Yb = 0.67;
%
global p
p = [ muhat Kn Yb ];
%-----------------------------------------------------------
% initial states
V = 1.2;
Sn = 29.5;
Xb = 349;
%
xo = [ V Sn Xb ];
%-----------------------------------------------------------
% integrate the state equation
to = clock;
[ t, x ] = ode45( 'Simple_Biological_Reactor', [0 1], xo );
etime( clock, to )
%-----------------------------------------------------------
% evaluate the outputs
y = Simple_Biological_Reactor_Outputs( t, x ); 
%-----------------------------------------------------------
% plot the results
figure;
[ hax ] = plotyy( 24*t, y(:,6), 24*t, y(:,5) );
axesyy( hax, [ 0 24 -300 400 0 93.3333 ], ...
   'Time in hours', ...
   'Active biomass in mg/l', ...
   'Nutrient in mg/l', 2, ...
   [ 0 200 400 ], [ 0 20 40 ] );
%
print -f1 -deps2 ex3-6.eps           
%-----------------------------------------------------------
% the end!   
