Académique Documents
Professionnel Documents
Culture Documents
NAME ID
Main function
clear all %clear all the garbages
clc % remove all variables which I used before
w0=0; % intiaL weight
wend=1000;% the final weight is equal to 1000
wspan=[w0 wend];% the limits of integration of the weight integration is
from w0 up t0 wend
fa0=10; %fa initial is equal to 10
fb0=10; %fb initial is equal to 10
fc0=0; %fc initial equals to 10
fd0=0; % fd initial is equal to 10
p0=1; % the value of p initial is equal to 1
f0=[fa0, fb0, fc0, fd0, p0]; % the values of fa0,fb0,fc0,fd0,p0 are set to fo
[w,f]=ode15s('Teklay', wspan, f0);% the solver we used is the ode function
that can be called by the calling function
fa=f(:,1);% put value of fa in column 1
fb=f(:,2);%put value of fa in column 2
fc=f(:,3);% put fc in column 3
fd=f(:,4);% put fd in column 4
p=f(:,5);% put values of p in column 5
figure(1)% to distinguish graph 1 from graph 2
plot(w,fa,'k',w,fb,'b',w,fc,'y',w,fd,w,p)% display graph of fa,fb,fc,fd,p
versus weight of catalyst respectively in graph one
ylabel('flowrate')% put me flow rate in the y axis
xlabel('weight of catalyst')% put me weight of catalyst in the x axis
title('flowrate versus weight of catalyst')% set the title of the plot as
flow rate versus weight of catalyst
legend('fa','fb','fc','fd','p')% display the curves with their respective
flowrates
scd= zeros(length(fd),1);% defines the length of the raw fd
for i=1:length(fd) % put the iteration at raw fd 1st raw
if(fd(i)>0.0001)%if the fd is greater than scd=0 then iterate untill
fd<0.0001
scd(i)=fc(i)/fd(i);
else % otherwise if the fd is< 0.0001 then scd=0
scd(i)=0;
end% terminate the length as it ends
figure(2)% distinguishes plot of graph 2 saparately from graph one
plot (w,Scd,'m')% plot secd versus w with m color
xlabel('W')% plot w in the x-axis
ylabel('Scd')% plote scd in the y axis
legend('Scd')% show me the curve with its respective selectivity
title('Scd vs. W')% plot scd vs w
Calling function
function dfdw =Teklay(w,f)% the function teklay accepts and calls the main
function
fa=f(1);% place fa at first column
fb=f(2);% place fb at second column
fc=f(3);% place fc at third column
fd=f(4);%put fd at forth column
p=f(5);put p at fifth column
k1a=100;% value of k1a is equal to 100
k2c=1500;% value of k2c is equal to 1500
ct0=0.2;%value of ct0 is equal to 0.2
ft=fa+fb+fc+fd;% ft is equal to the total summation of fa,fb.fc and fd
ca=ct0*(fa/ft)*p;% ca is expressed in the form of this eqaution
cb=ct0*(fb/ft)*p;% cb is expressed in the form of this eqaution
cc=ct0*(fc/ft)*p;% cc is expressed in the form of this eqaution
cd=ct0*(fd/ft)*p;% cd is expressed in the form of this eqaution
r1a=-k1a*ca*cb^2;% defines r1a interms of rate constant and concentrations
r1b=2*r1a;%relates r1b interms of r1a
rb=r1b;% express net rate of b
r2c=-k2c*ca^2*cb^3;% define r1a interms of rate constant and concentrations
r2a=2/3*r2c;%express the rate of reactions interms of relative rates
r2d=-1/3*r2c;%express the rate of reactions interms of relative rates
rd=r2d;% rd is related with r2d
r1c=-r1a;% r1c is expressed in relation to r1a
ra=r1a+r2a;% ra is equal to the summation the rates of the two reactions at
which a is found
rc=r1c+r2c;% rc is the sum of the rates of two reactions at which c is found
alpha=0.0019;%value of alpha is equal to 0.0019
ft0=20;% the value of ft0 is equal to 20
dfadw=ra;% the diffferential of fa with respect to catalist weight is equal
to ra
dfbdw=rb;% the diffferential of fb with respect to catalist weight is equal
to rb