Hi there.
I am trying to use MATLAB to make a plot of PA vs time for the problem ( see picture #1)
I am able to get a component balance in terms of conversion, but when I integrate and use MATLAB to plot the conversion vs time I get the result = infinity for conversion. I do not know what is going wrong with my code.
I have attached the problem statement, my work on how I arrived at the equations, and my MATLAB code.
I am really really stuck here and would appreciate any help...
The code is here
clear all
clc
k = 1*10^-3;
KA = 10;
W = 0.1;
T = 400;
P = 100;
yA0 = 0.5;
yB0 = 0.5;
NA0 = .5 % Assuming a basis of 1 mol to start
Ptot = 100;
PA0 = 50;
V = 100,000; %cm3
R = 8.314*10^3 %units cm3 kPA K-1mol-1
i = 1; % initial array index
x(i) = 0; % dimensionless, initial conversion
t(i) = 0; % s, initial time
dt = 0.5; % s, step size
trxn = 5000; % s, final time
while t(i) <= trxn
dxdt = W*k*((PA0*(1-x)).^2)/(1+KA*(PA0*(1-x))*(PA0*V/R*T));
x(i+1) = x(i) + dxdt * dt
t(i+1) = t(i) + dt;
i = i+1; % increment array index
end
plot(t,x)
tt = sprintf('Conversion vs. time, X is %4.4f at trxn = %4.2f', max(x),trxn)
title(tt)
ylabel('X'), xlabel('time (s)')
axis([0 ceil(max(t)) 0 1])
max(x)