How can I solve these differential equations?

3 views (last 30 days)
Huan Gu on 27 Oct 2021
Commented: Sam Chak on 27 Oct 2021
Hi,
I am trying to solve these three differential equations using the explicit equations I have. I also want to plot Fa vs. V, Fb vs. V, and Fc vs. V as shown in Figure E6-11. Please help me.
Thank you. Sam Chak on 27 Oct 2021
James was right. Items #7, 8, 9, 11 are unused. I listed out , , , and then performed the back substitutions.
E = 24000;
T = 697;
k = 0.29*exp(E/1.987*(1/500 - 1/T));
Cto = 1641/8.314/T;
Ca = Cto*y(1)/(y(1) + y(2) + y(3));
ra = - k*Ca^2;
rb = -ra;
rc = -ra/2;

James Tursa on 27 Oct 2021
A general outline would be to create your derivative function as follows:
function dy = myderivative(t,y,T,E)
Fa = y(1);
Fb = y(2);
Fc = y(3);
ra = _____; % you fill this in
rb = _____; % you fill this in
rc = _____; % you fill this in
dy = [ra;rb;rc];
end
Then in your main code have a function handle for this:
T = 698;
E = 24000;
f = @(t,y) myderivative(t,y,T,E)
Then you can use f along with some initial conditions and V span to call ode45().

Sam Chak on 27 Oct 2021
I've got these results, not exactly the same patterns, but very close.
clear all; clc
Vspan = 0:1e-9:1e-5;
y0 = [2.26e-5; 0; 0];
[V, y] = ode45(@(t,y) [- (0.29*exp(24000/1.987*(1/500 - 1/697)))*((1641/8.314/697)*y(1)/(y(1) + y(2) + y(3)))^2; (0.29*exp(24000/1.987*(1/500 - 1/697)))*((1641/8.314/697)*y(1)/(y(1) + y(2) + y(3)))^2; 0.5*(0.29*exp(24000/1.987*(1/500 - 1/697)))*((1641/8.314/697)*y(1)/(y(1) + y(2) + y(3)))^2],
Vspan, y0);
plot(V, y(:,1), 'linewidth', 2, 'Color', [0.4940, 0.1840, 0.5560], V, y(:,2), 'linewidth', 2, 'Color', [0.4660, 0.6740, 0.1880], V, y(:,3), 'linewidth', 2, 'Color', [0.9290, 0.6940, 0.1250])
legend('Fa', 'Fb', 'Fc')
grid on
xlabel('V (dm^3)')
ylabel('Flow rates (mol/s)') 