scaleSMatrix

PURPOSE ^

scaleSMatrix Scale stoichimetric matrix to integers

SYNOPSIS ^

function S = scaleSMatrix(S)

DESCRIPTION ^

scaleSMatrix Scale stoichimetric matrix to integers

 Sscaled = scaleSMatrix(S) 

INPUT
 S         S matrix

OUTPUT
 S         Scaled S matrix

 Markus Herrgard 6/2/06

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function S = scaleSMatrix(S)
0002 %scaleSMatrix Scale stoichimetric matrix to integers
0003 %
0004 % Sscaled = scaleSMatrix(S)
0005 %
0006 %INPUT
0007 % S         S matrix
0008 %
0009 %OUTPUT
0010 % S         Scaled S matrix
0011 %
0012 % Markus Herrgard 6/2/06
0013 
0014 % Round-off tolerance
0015 tol = 1e-7;
0016 
0017 numNonZero = 10;
0018 pow = 0;
0019 while (numNonZero > 0)
0020     numNonZero = sum(sum(abs(10^pow*S-round(10^pow*S)) > tol));
0021     fprintf('%d\t%d\n',pow,full(numNonZero));
0022     pow = pow + 1;
0023 end
0024 
0025 S = round(S*10^(pow-1));

Generated on Thu 21-Jun-2012 15:39:23 by m2html © 2003