Stoichiometric coefficient using matrix

%finding the appropriate stoichiometric coefficients for the folowing equation a1FeS + a2O2 = a3FeO + a4SO4
% Fe balance coefficients
Fe=[1 0 -1 0]; S = [1 0 0 -1]; O = [0 2 -1 -1]; b = [0; 0; 0; 0;];
A =[Fe;S;O];
X = A\b;
keep getting the same error code
Error using \
Matrix dimensions must agree.
Error in stoich_1 (line 6)
X = A\b;

3 件のコメント

darova
darova 2019 年 11 月 25 日
Matrix A is of 3x4 size. You only have 3 equations for 4 uknown variables
Ronald Aono
Ronald Aono 2019 年 11 月 27 日
thanks for the earlier response
%finding the appropriate stoichiometric coefficients for the folowing equation a1FeS + a2O2 = a3FeO + a4SO4
% Fe balance coefficients
Fe=[1 0 -1 0]; S = [1 0 0 -1]; O = [0 2 -1 -1];
A =[Fe;S;O;]; b = [0 0 0 ];
X = A\b'
getting my vector X as zero vector which i know its wrong
stoich_1
X =
0
0
0
0
Matt J
Matt J 2019 年 11 月 28 日
It is not wrong. X=zeros(4,1) is a valid solution.

サインインしてコメントする。

回答 (1 件)

Jyothis Gireesh
Jyothis Gireesh 2020 年 1 月 22 日

0 投票

Since the system of linear equations given above is of the form “Ax = 0”, the solution is given by the basis vectors of the null space of “A”. Any integral multiple of these basis vectors will also be a solution to the above system.
To determine the null space basis vectors, you may use the “null” function in MATLAB. In this case, the solution is given by
x = null(A);
which yields x = [0.5;0.5;0.5] as the result. All the other scaled versions of x will also be a solution.

カテゴリ

タグ

質問済み:

2019 年 11 月 25 日

回答済み:

2020 年 1 月 22 日

Community Treasure Hunt

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

Start Hunting!

Translated by