% This program uses the shooting technique to solve the tubular
% reactorproblem in section 7.1. The equation set and boundary
% conditions in Eqs. (7.1.9) - (7.1.12).
%
I = 1;

for CA0 = 0.00:0.1:1,
    x10 = 0; 
    c0 = [CA0 x10]';
    clear t c; % this is used to make sure that there is no
               % problem with vector lengths
    [t, c] = ode45n('model71',[ 0 1], c0);
    clear CA x1;
    CA = c(:, 1);
    x1 = c(:, 2);
    L = length(CA);
    index(I) = CA(L) - 0.01*x1(L);
    CA0plot(I) = CA0;
    boundary(I) = 1.0;
    I = I+1;
    
end

plot(CA0plot, index, '-', CA0plot, boundary, '--');
title('Response of Tubular Reactor Dispersion to Boundary Cond'); 
xlabel('Exit Dimensionless Concentration (CA(L)/CA0)');
ylabel('CA(0+)/CA0 - Daz*x1(0+)/(vz*CA0)');
%print fig74.eps
