You are on page 1of 20

# ASSIGNMENT No.

: __
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:

## 27.0000 0.0000 0.0604 14.9396 15.0000

28.0000 0.0000 0.0483 14.9516 15.0000

## 50.0000 0.0000 0.0004 14.9996 15.0000

GRAPH:
QUESTION: Modelling of batch reactor using RK-2 Method in MATLAB.

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:

## 2.7000 3.2475 7.8169 3.8694 14.9338

2.8000 3.1150 7.7902 4.0273 14.9325

## 5.6000 0.9703 5.9465 7.9947 14.9115

5.7000 0.9307 5.8655 8.1148 14.9111

## 8.5000 0.2899 3.7747 10.8401 14.9048

8.6000 0.2781 3.7102 10.9164 14.9047

## 11.4000 0.0866 2.2334 12.5828 14.9028

11.5000 0.0831 2.1918 12.6279 14.9028

## 14.3000 0.0259 1.2791 13.5973 14.9022

14.4000 0.0248 1.2543 13.6231 14.9022

## 17.2000 0.0077 0.7207 14.1736 14.9020

17.3000 0.0074 0.7064 14.1882 14.9020

## 20.1000 0.0023 0.4026 14.4970 14.9020

20.2000 0.0022 0.3946 14.5052 14.9020

## 23.0000 0.0007 0.2239 14.6773 14.9020

23.1000 0.0007 0.2194 14.6819 14.9020

## 25.9000 0.0002 0.1243 14.7775 14.9020

26.0000 0.0002 0.1218 14.7800 14.9020

## 28.8000 0.0001 0.0689 14.8330 14.9020

28.9000 0.0001 0.0675 14.8344 14.9020

## 31.7000 0.0000 0.0381 14.8638 14.9020

31.8000 0.0000 0.0374 14.8646 14.9020

## 34.6000 0.0000 0.0211 14.8808 14.9020

34.7000 0.0000 0.0207 14.8813 14.9020

## 37.5000 0.0000 0.0117 14.8903 14.9020

37.6000 0.0000 0.0114 14.8905 14.9020

GRAPH: