% This file calls the built in ODE solver, ode113 to solve the enclosed 
% tank model of section 3.5.
%
[T, Z] = ode113('fun35', [0 0.4], 1.0);

%
% F1 is the dimensionless inflow rate;
% F2 is the dimensionless outflow rate;
% P2 is the dimensionless pressure at the tank bottom.
%
Vg = 2-Z;
Tg = (1./Vg).^0.343;
Pg = 0.735.*Tg./Vg;

P2 = Pg + 0.2167*Z;
P1 = 1.;
P3 = .785;
F1 = 4.541*sqrt(P1-P2);
F2 = 4.541*sqrt(P2-P3);

plot(T,Z,'-', T,F1,'--', T,F2,'-.', T,P2,':');
title('Dimensionless Tank Response (tank35)');
xlabel('Dimensionless time');
text(0.1, 1.6, 'Dimensionless outflow rate');
text(0.1, 1.37, 'Dimensionless inflow rate');
text(0.1, 1.0, 'Dimensionless tank height');
text(0.1, 0.85, 'Dimensionless tank bottom pressure');
