Escolar Documentos
Profissional Documentos
Cultura Documentos
1
1 0 –1 0 x1 0 2
A = 4 0 0 –2 , x = xx 2 , b = 0 1
0 2 –2 –1 3 0
0 0 0 1 x4 1 2
Next we consider how this system can be solved using Thus, the balanced equation is
MATLAB.
CH 4 + 2O 2 → CO 2 + 2H 2O
The MATLAB Solution
Conservation of Mass and Charge
MATLAB is a general-purpose mathematics
program that was originally designed to solve problems The reaction shown in the first example could
involving matrices. (The name MATLAB is a easily be balanced by inspection. Not so with the
contraction of Matrix Laboratory.) This program is following equation:
ideally suited for solving matrix equations of the form Ax
= b. 2– 2+
x 1Cr2O 7 + x2Fe + x3H
+
→ x4Cr 3+ + x 5Fe 3+ + x 6H 2O
After starting MATLAB, we enter the matrix A
and the column vector b. (In what follows, » is the
MATLAB prompt.) At first glance, it might appear that this equation cannot
be balanced algebraically because there are six unknown
» A = [ stoichiometric coefficients but only four elements to
1 0 -1 0 conserve (Cr, O, Fe, and H). However, charge must be
4 0 0 -2 conserved as well, giving rise to another balance
0 2 -2 -1 equation. That, plus an auxiliary equation setting the
0 0 0 1]; value of one coefficient, yields six equations in six
unknowns:
» b = [
0 Chromium (Cr): 2x 1 – x 4 = 0
0
0 Oxygen (O): 7x 1 – x6 = 0
1]; Iron (Fe): x 2 – x 5 = 0
Hydrogen (H): x 3 – 2x 6 = 0
Next we compute x = A–1b, in which A–1 is the inverse Charge (+): –2x 1 + 2x2 + x3 – 3x4 – 3x 5 = 0
of A. The function inv() computes matrix inverses:
(*): x6 = 1
» x = inv(A)*b
From these equations we obtain
x =
2 0 0 –1 0 0 0
0.5000 7 0 0 0 0 –1 0
1.0000 A = 0 1 0 0 –1 0 , b = 0
0 0 1 0 0 –2 0
0.5000 –2 2 1 –3 –3 0 0
1.0000 0 0 0 0 0 1 1
Finally, we note that the stoichiometric coefficients are Using MATLAB, the unknown stoichiometric
usually chosen to be integers. Divide the vector x by its coefficients are quickly determined. First we enter A and
smallest value: b:
» A = [
2 0 0 -1 0 0 x 1P2I 4 + x 2P4+ x3H 2O → x 4PH4I + x5 H3PO 4
7 0 0 0 0 -1
0 1 0 0 -1 0
0 0 1 0 0 -2 What makes this reaction difficult is that phosphorus
-2 2 1 -3 -3 0 appears in four different oxidation states. Nevertheless,
0 0 0 0 0 1]; we can easily balance this reaction using MATLAB:
» b = [ » A = [
0 2 4 0 -1 -1
0 4 0 0 -1 0
0 0 0 2 -4 -3
0 0 0 1 0 -4
0 0 0 0 0 1
1]; ];
Next we solve the system, this time using the left division » b = [
operator (\) instead of the inv() function. The left division 0
0
operator uses LU factorization rather than matrix
0
inversion, and is the preferred method of solution: 0
1];
» x = A\b
» x = A\b
x =
x =
0.1429
0.8571 0.3125
2.0000 0.4062
0.2857 4.0000
0.8571 1.2500
1.0000 1.0000
We divide by the smallest value of x to obtain integral We divide by the first element of x to obtain integral
coefficients. In the this case, the smallest value is found coefficients:
in the first element, designated by x(1):
» x = x/x(1)
» x = x/x(1)
x =
x =
1.0000
1.0000 1.3000
6.0000 12.8000
14.0000 4.0000
2.0000 3.2000
6.0000
7.0000 This does not yield integral coefficients, but multiplying
by 10 will do the trick:
Thus we obtain
» x = x * 10
Cr2O 7 + 6Fe + 14H → 2Cr + 6Fe + 7H 2O
2– 2+ + 3+ 3+
x =
2 MnO 4 + 5 H 2O 2 + 6 H → 2 Mn + 5 O 2 + 8 H2O
– + 2+
2 H2O 2 → O 2 + 2 H 2O
Summary
The procedure for balancing a chemical
equation with MATLAB may be summarized as follows: