Sunteți pe pagina 1din 3

LINEAR ALGEBRA FOR STOICHIOMETRIC COEFICIENTS

1: DETERMINE A, B, C, D & E IN DEPENDENCE OF F


The charge and element balances are derived from the chemical composition of the single components:

aC 6H 12O6 + b NH 4+ + c H 2O + d H + + e HCO3 + f C 3H 5O3 + CH 1.8O0.5N 0.2 = 0


This chemical equation translates to the following balances in Matrix notation:

6
12

6
0

0 0 0
4 2 1
0 1 0
1 0 0
1 0 1


1 3
1
b
c
1 5 1.8


3 3 0.5 = d = 0
e
0 0 0.2


1 1 0
f

(1)

This equation system has 5 equations and 6 unknown, thus one degree of freedom. One variable (f) is chosen
as independent variable. The vector of parameters is separated in the independent part (f and 1, for biomass)
and the dependent part (a,b,.c,d,e):

6
12

6
0

0
4
0
1
1

0 1 a 3
1 1 b 5

0 3 c + 3

0 0 d 0

1 1 e 1

0
2
1
0
0
A

1
0

0
1.8
f

0.5 = 0
1
0.2
0

0
0

(2)

Rearrange, move all known & independent to the right side:

6
12

6
0

0
4
0
1
1

0
2
1
0
0
A

0 1 a
3

1 1 b
5

0 3 c = 3

0 0 d
0

1
1 1 e

x
d
A

1
1.8
f
0.5
1
0.2
x
0 f

(3)

The solution then becomes:

x d = A d 1 A f x f

(4)

In MATLAB the same steps are performed the same way:


clear all
%
a
A = [6
12
6
0
0

b
0
4
0
1
1

c
0
2
1
0
0

d
0
1
0
0
1

e
1
1
3
0
-1

f
3
5
3
0
-1

1
1;
1.8;
0.5;
0.2;
0];

(5 min)

Ad = A(:,1:5);
Af = A(:,6:7);
syms f;

% declare the symbolic variable f

x = -inv(Ad) * Af * [f; 1]

(5 min)

% solve the system (symbolically, because of f)

2: ADDITION OF THE DEGREE OF REDUCTION BALANCE


The addition of this balance does not solve the system. The added equation does NOT add any addition
information on the relation of the variables.
Note, the degree of reduction is CALCULATED from the carbon, hydrogen, oxygen, nitrogen and charge of the
molecule. The added line can be constructed by adding the lines 4*C + 1 H 2*O 3*N - charge
Consequently, the matrix is rank deficient, and the inverse does not exist (singular matrix)
3: PLOT SOLUTION

The symbolic solution can be used to generate the plot, using the command subs:
clear all
%
a
A = [6
12
6
0
0

b
0
4
0
1
1

c
0
2
1
0
0

d
0
1
0
0
1

e
1
1
3
0
-1

f
3
5
3
0
-1

1
1;
1.8;
0.5;
0.2;
0];

(5 min)

Ad = A(:,1:5); Af = A(:,6:7);
syms f;
% declare the symbolic variable f
(5 min)
x = -inv(Ad) * Af * [f; 1]
% solve the system (symbolically, because of f)
fval = 1:0.1:2;

% values of f

(5 min)

xval = [];
% empty matrix to store solutions
for i=1:length(fval)
xval = [xval subs(x, 'f', fval(i))]; % substitute with all fval and store
end
% make the plot and label it
(5 min)
plot(fval, xval(1,:),'b', fval, xval(5,:), 'r');
xlabel('f'); ylabel('a, e'); legend('a','e');

0.2
0
-0.2
a
e

a, e

-0.4
-0.6
-0.8
-1
-1.2

1.2

1.4

1.6
f

1.8

S-ar putea să vă placă și