cantera/interfaces/matlab/toolbox/@Kinetics/stoich_net.m
Ray Speth 2528df0f75 Reorganized source tree structure
These changes make it unnecessary to copy header files around during
the build process, which tends to confuse IDEs and debuggers. The
headers which comprise Cantera's external C++ interface are now in
the 'include' directory.

All of the samples and demos are now in the 'samples' subdirectory.
2012-02-12 02:27:14 +00:00

30 lines
1 KiB
Matlab
Executable file

function nu = stoich_net(a,species,rxns)
% stoich_net Net stoichiometric coefficients.
%
% nu = stoich_net(a)
%
% Returns a sparse matrix of all net (product - reactant)
% stoichiometric coefficients. The matrix element nu(k,i) is the
% net stoichiometric coefficient of species k in reaction i.
%
% nu = stoich_net(a, species, rxns)
%
% Returns a sparse matrix the same size as above, but
% containing only entries for the specified species and
% reactions. For example, stoich_net(a,3,[1 3 5 7]) returns a
% sparse matrix containing only the coefficients for species 3
% in reactions 1, 3, 5, and 7.
%
% Note that the net stoichiometric coefficients may be negative,
% unlike the reactant or product stoichiometric coefficients.
%
% See also: stoich_r, stoich_p.
%
if nargin == 1
nu = stoich_p(a) - stoich_r(a)
elseif nargin == 3
nu = stoich_p(a,species,rxns) - stoich_r(a,species,rxns);
else
error(['syntax error. Type ''help stoich_net'' for more' ...
' information.'])
end