2412 The following differential equation describes the stead
     24.12 The following differential equation describes the steady-state concentration of a substance that reacts with first-order kinetics in an axially dispersed plug-flow reactor (Fig. P24.12): dx2 dx where D the dispersion coefficient (m /hr), c concen tration (mol/L), x distance (m), U the velocity (m/hr), 637 reactor. 
 
  
  Solution
% Centred Difference method
%The length is divided in to 10 segments starting from x=0 (denoted 1) to
%x=100 (denoted as 11)
D=5000;
U=100;
k=2;
L=100;
Cin=100;
step=10;
x=[0:step:100];
for i=1:length(x)
for j=1:length(x)
if j==i-1
A(i,j)=1+(U*step)/(2*D);
elseif j==i
A(i,j)=-(2+(k*step^2)/D);
elseif j==i+1
A(i,j)=1-(U*step)/(2*D);
else
A(i,j)=0;
end
end
A(1,1)=-62/25;
A(1,2)=2;
A(11,10)=2;
x(i+1)=x(i)+step;
end
b=[-44;0;0;0;0;0;0;0;0;0;0];
C=A\\b;
C


