You are on page 1of 3

T.

SAI VARMA
19021A0828
MATLAB Code:
%size of plug flow reactor
%simpsons rule,trapezoidal rule
function varma1
clc
clear all
xa(1)=0;
fx(1)=1;
sc=0.8;
h=0.1;
n=sc/h;
fprintf('xa\t (1+(0.75*xa))/(1-xa)\n')
for i=1:n
xa(i+1)=xa(i)+h;
fx(i+1)=vv5a(xa(i+1));
fprintf('%4.1f\t %7.4f\n',xa(i+1)',fx(i+1)')
end
Vs=((40)/(60*10))*(h/3)*(fx(1)+fx(n+1)+4*sum(fx(2:2:n))+2*sum(fx(3:2:n-1)));
Vt=((40)/(60*10))*(h/2)*(fx(1)+fx(n+1)+2*sum(fx(2:1:n)));
fprintf('the size of PFR for 0.8 conversion for simpons method is Vs=%6.4f\t m^3\n',Vs)
fprintf('the size of PFR for 0.8 conversion for trapezoidal method is Vt=%6.4f\t m^3\n',Vt)
plot(xa,fx),area(xa,fx)
title('variation of (1+(0.75*xa))/(1-xa) with xa')
xlabel('xa'),ylabel('(1+(0.75*xa))/(1-xa)')

function xy=vv5a(xa)
fx=((1+(0.75*xa))/(1-xa));
xy=[fx];
T.SAI VARMA
19021A0828

Output:
xa (1+(0.75*xa))/(1-xa)
0.1 1.1944
0.2 1.4375
0.3 1.7500
0.4 2.1667
0.5 2.7500
0.6 3.6250
0.7 5.0833
0.8 8.0000
the size of PFR for 0.8 conversion for simpons method is Vs=0.1479 m^3
the size of PFR for 0.8 conversion for trapezoidal method is Vt=0.1500 m^3
T.SAI VARMA
19021A0828

GRAPH:

You might also like