フィルターのクリア

Multiple ODE's that are coupled

1 回表示 (過去 30 日間)
Rick
Rick 2014 年 11 月 2 日
編集済み: Rick 2014 年 11 月 2 日
Hello,
I attached a PDF of the coupled ODE's that I am trying to solve. I can make a function that runs, but I don't get the same output as the PDF for my graphs, what is going wrong?? The reaction rate plot is clearly wrong
function dz = semibatch(t,z)
k = 2.2;
V0 = 5;
v0 = 0.05;
V = @(t) V0 + v0*t;
CB0 = 0.025;
CA0 = 0.05;
dz = zeros(4,1);
dz(1) = -k*z(1).*z(2) - (v0.*z(1)./V(t));
dz(2) = -k*z(1).*z(2) + ((CB0-z(2)).*v0./V(t));
dz(3) = k*z(1).*z(2) - (v0*z(3)./V(t));
dz(4) = k*z(1).*z(2) - (v0*z(4)./V(t));
end
This is what is in my script file,
CA0 = 0.05;
CB0 = 0.025;
k = 2.2;
v0 = 0.05;
V0 = 5;
V = @(t) V0 + v0*t;
[T,Z] = ode45(@semibatch,[0 500],[CA0, CB0, 0, 0]);
plot(T,Z(:,1),T,Z(:,2),T,Z(:,3))
xlabel('time')
ylabel('C_{i}')
legend('C_{A}','C_{B}','C_{C}')
X = [];
rA = [];
for i = 1:size(Z,1)
X(i) = (CA0*V0 - Z(i,1)*V(T(i)))/(CA0*V0);
rA(i) = -k*Z(i,1)*Z(i,2);
end
figure
subplot(1,2,1)
plot(T,X)
xlabel('time')
ylabel('conversion')
subplot(1,2,2)
plot(T,rA)
xlabel('time')
ylabel('reaction rate')

回答 (0 件)

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by