It's me again. The code is not working, I keep getting 0 as the answer for A, B, C, D, E, and F.
I need help with a material balance problem.
6 views (last 30 days)
Show older comments
FUNCTION:
function [A, B, C, D, E, F] = material_balance (Ao, Bo, Co, Do, Eo, Fo)
[A, B, C, D, E, F] = Ao+Bo+Co+Do+Eo+Fo
k21 =0.2;
k31 =0.1;
k32 =0.1;
k34 =0.1 ;
k54 =0.05;
k64 =0.2 ;
k12 =0.1 ;
k13 =0.05 ;
k23 =0.05;
k43 =0.2 ;
k45 =0.1;
k46 =0.2;
k65 =0.1;
k56 =0.1;
x = [ -(k21+k31) k12 k13 0 0 0
k31 k32 -(k13+k23+k43) k34 0 0
0 0 0 k54 -(k45-k65) k56
k21 -(k12+k32) k23 0 0 0
0 0 k43 -(k34+k54+k64) 0 k45
0 0 0 k64 k65 -(k46+k56)];
b = [0
0
0
0
0
0];
[A B C D E F]= inv(x)*b
SCRIPT:
clear, clc, close all
Ao =1.0;
Bo =0;
Co =0 ;
Do =0 ;
Eo =1.0;
Fo= 0;
[A, B, C, D, E, F] = material_balance (Ao, Bo, Co, Do, Eo, Fo)
Please Help!

5 Comments
Torsten
on 21 Feb 2019
You set the time derivatives to zero and solved
x*[A;B;C;D;E;F] = 0
But you are told to solve
x*[A;B;C;D;E;F] =[dA/dt;dB/dt;dC/dt;dD/dt;dE/dt;dF/dt].
Try an ODE integrator to do so, e.g. ODE15S.
Answers (0)
See Also
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!