function dNbydt = semibatch(t, N) % Done on 16-Jul-2001 by M.Subramanian; msubbu@svce.ac.in %* Problem Statement: %* It is proposed to produce X, Y, and Z from A and B by chemical reaction %* on a semibatch basis. That is, 1000 ltrs of pure A of concentration %* 15 mol/ltr is charged in the reactor and B is added at the rate of %* 50 ltr/min at a concentration 10 mol/ltr. If all the reactions are %* second order and are represented stoichiometrically by the equations: %* A + B --> X k1 = 0.18 ltr/mol.min %* X + B --> Y k2 = 0.03 ltr/mol.min %* Y + B --> Z k3 = 0.1 ltr/mol.min %* Prepare a plot of moles of products formed as a function of time. k1 = 0.18; % ltr/mol.min k2 = 0.03; % ltr/mol.min k3 = 0.1; % ltr/mol.min Vo = 1000; % ltr. initial volume of reactor contents. vo = 50; % ltr/min. Flow rate of B Fbo = 500; % mol/min. Molar flow rate of B V = Vo + vo*t; % Notations: A=1; B=2; X=3; Y=4; Z=5; dNbydt = zeros(5,1); % a column vector dNbydt(1) = -k1*N(1)*N(2)/V; dNbydt(2) = Fbo - (k1*N(1)*N(2) + k2*N(3)*N(2) + k3*N(4)*N(2))/V; dNbydt(3) = (k1*N(1)*N(2) - k2*N(3)*N(2))/V; dNbydt(4) = (k2*N(3)*N(2) - k3*N(4)*N(2))/V; dNbydt(5) = k3*N(4)*N(2)/V; % Issue the following commands in MATLAB-command prompt: % N0 = [15000 0 0 0 0]' % [t,N] = ode45('semibatch',[0 150],N0); % plot(t,N) %*************************************************