I need help with a material balance problem.

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!
Screen Shot 2019-02-19 at 9.46.09 PM.png

5 Comments

It's me again. The code is not working, I keep getting 0 as the answer for A, B, C, D, E, and F.
It's an simultaneous ordinary differential equations. Please refer to the following ode45 documentation page.
Do you try to calculate the steady state for your chemical system ?
How do I calculate a steady state?
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.

Sign in to comment.

Answers (0)

Tags

Asked:

on 20 Feb 2019

Commented:

on 21 Feb 2019

Community Treasure Hunt

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

Start Hunting!