%
% Example 3.4: Simple Aerated Tank
%
% Bob Newell, March 1996
%
%-----------------------------------------------------------
%
function dxdt = Simple_Aerated_Tank( t, x )
global p
%
% x = [ 1=V 2=Ss 3=So ];
% y = [ 1=v_in 2=Ss_in 3=So_in, 
%       4=v_out 5=Ss_out 6=So_out,
%       7=v_a ];
% p = [ 1=Ka 2=So_sat ];
%
%-----------------------------------------------------------
  y = Simple_Aerated_Tank_Outputs( t, x );
  dxdt = zeros( 3, 1 );
%
  dxdt(1) = y(1) - y(4);
  dxdt(2) = ( y(1) * y(2) - y(4) * y(5) ) / x(1);
  dxdt(3) = ( y(1) * y(3) - y(4) * y(6) ...
           + p(1) * y(7) * ( p(2) - x(3) ) ) / x(1);
%-----------------------------------------------------------
% the end!   
