% This file calls  the built-in ode45 routine
% to solve the benzene chlorination problem in section 4.1;
%

y0 = [1.0 0 0 0 0]';
[T, N] = ode113('model41', [0 1000], y0);

Nb0 = 50;
V = 1.46*Nb0;
k1 = 510;

%
% convert to dimensional cases
%
tau = V/(k1*Nb0);

t = tau*T;
N = N*Nb0;

NB = N(:,1);
NM = N(:,2);
ND = N(:,3);
NT = N(:,4);
NC = N(:,5);

plot(t, NB, '-', t, NM, '--', t, ND, '-.', t, NT, ':', t, NC, '.');
title('Concentration Profiles for Chlorination of Benzene (Example 4.1)');
xlabel('Time (hr)');
ylabel('Concentration (kmol)');
text(0.2, 41, 'B');
text(0.75, 38, 'M');
text(1.75, 46, 'D');
text(2.25, 9, 'T');
text(1.1, 5, 'C');
%grid on;
