%
% Example 3.3: Simple Buffer Tank
%
% - constant volume
% - well mixed
%
% Bob Newell, March 1996
%
%-----------------------------------------------------------
% parameters

%
global p
p = [];
%-----------------------------------------------------------
% initial states
M = 1;
Ss = 100;
%
xo = [ M Ss ];
%-----------------------------------------------------------
% integrate the state equation
to = clock;
[ t, x ] = ode45( 'Simple_Buffer_Tank', [0 1], xo );
etime( clock, to )
%-----------------------------------------------------------
% evaluate the outputs
y = Simple_Buffer_Tank_Outputs( t, x ); 
%-----------------------------------------------------------
% plot the results
figure;
hax = plotyy( 24*t, y(:,[1 3]), 24*t, y(:,[2 4]) );
axesyy( hax, [ 0 24 -15 15 100 400 ], ...
   'Time in hours', ...
   'Flowrate in Ml/d', ...
   'Nutrient in mg/l', 2, ...
   [ 0 5 10 15 ], [ 100 150 200 250 ] );
%
h = text( 7, 7.5, 'Inlet and Outlet' );
set( h, 'fontsize', 16 );
h = text( 6.5, -7.5, 'Inlet' );
set( h, 'fontsize', 16 );
h = text( 14, -7.5, 'Outlet' );
set( h, 'fontsize', 16 );
%
print -f1 -deps2 ex3-3b.eps
%-----------------------------------------------------------
% the end!   
