%
% Example 3.2: Tank with Overflow Weir
%
% Bob Newell, March 1996
%
%-----------------------------------------------------------
% parameters
rho = 1000;
A = 2;
H = 0.5;
n = 1;
L = 1;
expon = 1.5;
%
global p
p = [ rho A H n L expon ];
%-----------------------------------------------------------
% initial states
M = 1057.8;
%
xo = [ M ];
%-----------------------------------------------------------
% integrate the state equation
to = clock;
[ t, x ] = ode45( 'Overflow_Weir_Tank', [0 300], xo );
etime( clock, to )
%-----------------------------------------------------------
% evaluate the outputs
y = Overflow_Weir_Tank_Outputs( t, x ); 
%-----------------------------------------------------------
% plot the results
figure;
hax = plotyy( t, y(:,1), t, y(:,2) );
axesyy( hax, [ 0 300 -15 15 0 30 ], ...
   'Time in seconds', ...
   'Inlet flowrate in kg/s', ...
   'Outlet flowrate in kg/s', 2, ...
   [ 0 5 10 15 ], [ 0 5 10 15 ] );
%
print -f1 -deps2 ex3-2.eps
%-----------------------------------------------------------
% the end!   
