Professional Documents
Culture Documents
: __
QUESTION: Modelling of batch reactor using Euler’s Method in MATLAB.
ASNWER:
PROGRAM:
%To study performance ofbatch reactor using Euler's Method
%concentration of a= Ca(mol/m3)
Ca(1)=10;
%concentration of b= Cb(mol/m3)
Cb(1)=5;
%concentration of c= Cc(mol/m3)
Cc(1)=0;
% Rate Constant=k1,k2(1/s)
k1=0.4;
k2=0.2;
h=1
t(1)=0;
for i=1:50
t(i+1)=t(i)+h
Ca(i+1)=Ca(i)-h*(k1*Ca(i))
Cb(i+1)=Cb(i)+h*(k1*Ca(i)-k2*Cb(i))
Cc(i+1)=Cc(i)+h*(k2*Cb(i))
total=Ca+Cb+Cc
end
[t',Ca',Cb',Cc',total']
plot(t,Ca,'--',t,Cb,t,Cc,':')
legend('Ca','Cb','Cc')
xlabel('time')
ylabel('concentration')
Title('Batch Reactor')
OUTPUT:
ASNWER:
PROGRAM:
% To study performance of batch reactor using RK-2 Method.
%Concentration Of a= Ca(mol/m3)
Ca(1)=10;
%Concentration Of b= Cb(mol/m3)
Cb(1)=5;
%Concentration Of c= Cc(mol/m3)
Cc(1)=0;
%Rate Constant= k1,k2(1/s)
k1=0.4;
k2=0.2;
%step size=h
h = 0.1;
t(1)=0;
for i=1:400
t(i+1)= t(i)+h
a=h*(k1*Ca(i))
b=h*(k1*(Ca(i)+a))
c=(a+b)/2
Ca(i+1)=Ca(i)-c
a=h*((k1*Ca(i)-k2*Cb(i)))
b=h*(k1*(Ca(i)+a)-k2*(Cb(i)+a))
%Ca(i+1)=Ca(i)-h*(k1*Ca(i))
c=(a+b)/2
Cb(i+1)=Cb(i)+c
a=h*(k2*Cb(i))
b=h*(k2*(Cb(i)+a))
c=(a+b)/2
Cc(i+1)=Cc(i)+c
%Cb(i+1)= Cb(i)+h*(k1*Ca(i)-k2*Cb(i))
%Cc(i+1)=Cc(i)+h*(k2*Cb(i))
total=Ca+Cb+Cc
end
[t',Ca',Cb',Cc',total']
plot(t,Ca,'--',t,Cb,t,Cc,':')
legend('Ca','Cb','Cc')
xlabel('time')
ylabel('Concentration')
Title('BATCH REACTOR')
OUTPUT: