# Generated Code

The following is matlab code generated by the CellML API from this CellML file. (Back to language selection)

The raw code is available.

```function [VOI, STATES, ALGEBRAIC, CONSTANTS] = mainFunction()
% This is the "main function".  In Matlab, things work best if you rename this function to match the filename.
[VOI, STATES, ALGEBRAIC, CONSTANTS] = solveModel();
end

function [algebraicVariableCount] = getAlgebraicVariableCount()
% Used later when setting a global variable with the number of algebraic variables.
% Note: This is not the "main method".
algebraicVariableCount =132;
end
% There are a total of 94 entries in each of the rate and state variable arrays.
% There are a total of 82 entries in the constant variable array.
%

function [VOI, STATES, ALGEBRAIC, CONSTANTS] = solveModel()
% Create ALGEBRAIC of correct size
global algebraicVariableCount;  algebraicVariableCount = getAlgebraicVariableCount();
% Initialise constants and state variables
[INIT_STATES, CONSTANTS] = initConsts;

% Set timespan to solve over
tspan = [0, 10];

% Set numerical accuracy options for ODE solver
options = odeset('RelTol', 1e-06, 'AbsTol', 1e-06, 'MaxStep', 1);

% Solve model with ODE solver
[VOI, STATES] = ode15s(@(VOI, STATES)computeRates(VOI, STATES, CONSTANTS), tspan, INIT_STATES, options);

% Compute algebraic variables
[RATES, ALGEBRAIC] = computeRates(VOI, STATES, CONSTANTS);
ALGEBRAIC = computeAlgebraic(ALGEBRAIC, CONSTANTS, STATES, VOI);

% Plot state variables against variable of integration
[LEGEND_STATES, LEGEND_ALGEBRAIC, LEGEND_VOI, LEGEND_CONSTANTS] = createLegends();
figure();
plot(VOI, STATES);
xlabel(LEGEND_VOI);
l = legend(LEGEND_STATES);
set(l,'Interpreter','none');
end

function [LEGEND_STATES, LEGEND_ALGEBRAIC, LEGEND_VOI, LEGEND_CONSTANTS] = createLegends()
LEGEND_STATES = ''; LEGEND_ALGEBRAIC = ''; LEGEND_VOI = ''; LEGEND_CONSTANTS = '';
LEGEND_VOI = strpad('time in component environment (minute)');
LEGEND_STATES(:,1) = strpad('c1 in component c1 (molecules)');
LEGEND_ALGEBRAIC(:,1) = strpad('v1 in component v1 (flux)');
LEGEND_STATES(:,2) = strpad('c2 in component c2 (molecules)');
LEGEND_ALGEBRAIC(:,11) = strpad('v6 in component v6 (flux)');
LEGEND_CONSTANTS(:,81) = strpad('v13 in component v13 (flux)');
LEGEND_STATES(:,3) = strpad('c3 in component c3 (molecules)');
LEGEND_ALGEBRAIC(:,8) = strpad('v2 in component v2 (flux)');
LEGEND_STATES(:,4) = strpad('c4 in component c4 (molecules)');
LEGEND_ALGEBRAIC(:,9) = strpad('v3 in component v3 (flux)');
LEGEND_STATES(:,5) = strpad('c5 in component c5 (molecules)');
LEGEND_ALGEBRAIC(:,12) = strpad('v7 in component v7 (flux)');
LEGEND_ALGEBRAIC(:,13) = strpad('v8 in component v8 (flux)');
LEGEND_STATES(:,6) = strpad('c6 in component c6 (molecules)');
LEGEND_ALGEBRAIC(:,15) = strpad('v10 in component v10 (flux)');
LEGEND_ALGEBRAIC(:,16) = strpad('v60 in component v60 (flux)');
LEGEND_STATES(:,7) = strpad('c7 in component c7 (molecules)');
LEGEND_ALGEBRAIC(:,10) = strpad('v4 in component v4 (flux)');
LEGEND_ALGEBRAIC(:,125) = strpad('v5 in component v5 (flux)');
LEGEND_STATES(:,8) = strpad('c8 in component c8 (molecules)');
LEGEND_ALGEBRAIC(:,19) = strpad('v12 in component v12 (flux)');
LEGEND_ALGEBRAIC(:,20) = strpad('v14 in component v14 (flux)');
LEGEND_ALGEBRAIC(:,21) = strpad('v62 in component v62 (flux)');
LEGEND_STATES(:,9) = strpad('c9 in component c9 (molecules)');
LEGEND_ALGEBRAIC(:,22) = strpad('v15 in component v15 (flux)');
LEGEND_ALGEBRAIC(:,126) = strpad('v107 in component v107 (flux)');
LEGEND_ALGEBRAIC(:,127) = strpad('v110 in component v110 (flux)');
LEGEND_ALGEBRAIC(:,128) = strpad('v113 in component v113 (flux)');
LEGEND_ALGEBRAIC(:,129) = strpad('v116 in component v116 (flux)');
LEGEND_ALGEBRAIC(:,130) = strpad('v119 in component v119 (flux)');
LEGEND_ALGEBRAIC(:,131) = strpad('v122 in component v122 (flux)');
LEGEND_ALGEBRAIC(:,132) = strpad('v125 in component v125 (flux)');
LEGEND_STATES(:,10) = strpad('c10 in component c10 (molecules)');
LEGEND_ALGEBRAIC(:,17) = strpad('v11 in component v11 (flux)');
LEGEND_STATES(:,11) = strpad('c11 in component c11 (molecules)');
LEGEND_STATES(:,12) = strpad('c12 in component c12 (molecules)');
LEGEND_ALGEBRAIC(:,103) = strpad('v106 in component v106 (flux)');
LEGEND_ALGEBRAIC(:,108) = strpad('v109 in component v109 (flux)');
LEGEND_ALGEBRAIC(:,112) = strpad('v112 in component v112 (flux)');
LEGEND_ALGEBRAIC(:,116) = strpad('v115 in component v115 (flux)');
LEGEND_ALGEBRAIC(:,118) = strpad('v118 in component v118 (flux)');
LEGEND_ALGEBRAIC(:,120) = strpad('v121 in component v121 (flux)');
LEGEND_ALGEBRAIC(:,122) = strpad('v124 in component v124 (flux)');
LEGEND_STATES(:,13) = strpad('c13 in component c13 (molecules)');
LEGEND_ALGEBRAIC(:,18) = strpad('v61 in component v61 (flux)');
LEGEND_STATES(:,14) = strpad('c14 in component c14 (molecules)');
LEGEND_STATES(:,15) = strpad('c15 in component c15 (molecules)');
LEGEND_ALGEBRAIC(:,23) = strpad('v16 in component v16 (flux)');
LEGEND_ALGEBRAIC(:,29) = strpad('v22 in component v22 (flux)');
LEGEND_ALGEBRAIC(:,39) = strpad('v32 in component v32 (flux)');
LEGEND_ALGEBRAIC(:,41) = strpad('v34 in component v34 (flux)');
LEGEND_ALGEBRAIC(:,44) = strpad('v37 in component v37 (flux)');
LEGEND_ALGEBRAIC(:,46) = strpad('v39 in component v39 (flux)');
LEGEND_ALGEBRAIC(:,96) = strpad('v102 in component v102 (flux)');
LEGEND_STATES(:,16) = strpad('c16 in component c16 (molecules)');
LEGEND_STATES(:,17) = strpad('c17 in component c17 (molecules)');
LEGEND_ALGEBRAIC(:,67) = strpad('v63 in component v63 (flux)');
LEGEND_ALGEBRAIC(:,73) = strpad('v69 in component v69 (flux)');
LEGEND_ALGEBRAIC(:,87) = strpad('v79 in component v79 (flux)');
LEGEND_ALGEBRAIC(:,89) = strpad('v80 in component v80 (flux)');
LEGEND_ALGEBRAIC(:,91) = strpad('v81 in component v81 (flux)');
LEGEND_ALGEBRAIC(:,93) = strpad('v82 in component v82 (flux)');
LEGEND_STATES(:,18) = strpad('c18 in component c18 (molecules)');
LEGEND_ALGEBRAIC(:,14) = strpad('v9 in component v9 (flux)');
LEGEND_ALGEBRAIC(:,68) = strpad('v64 in component v64 (flux)');
LEGEND_STATES(:,19) = strpad('c19 in component c19 (molecules)');
LEGEND_ALGEBRAIC(:,69) = strpad('v65 in component v65 (flux)');
LEGEND_ALGEBRAIC(:,70) = strpad('v66 in component v66 (flux)');
LEGEND_ALGEBRAIC(:,71) = strpad('v67 in component v67 (flux)');
LEGEND_ALGEBRAIC(:,72) = strpad('v68 in component v68 (flux)');
LEGEND_ALGEBRAIC(:,99) = strpad('v105 in component v105 (flux)');
LEGEND_STATES(:,20) = strpad('c20 in component c20 (molecules)');
LEGEND_ALGEBRAIC(:,106) = strpad('v108 in component v108 (flux)');
LEGEND_STATES(:,21) = strpad('c21 in component c21 (molecules)');
LEGEND_ALGEBRAIC(:,110) = strpad('v111 in component v111 (flux)');
LEGEND_STATES(:,22) = strpad('c22 in component c22 (molecules)');
LEGEND_ALGEBRAIC(:,31) = strpad('v24 in component v24 (flux)');
LEGEND_ALGEBRAIC(:,42) = strpad('v35 in component v35 (flux)');
LEGEND_ALGEBRAIC(:,45) = strpad('v38 in component v38 (flux)');
LEGEND_ALGEBRAIC(:,75) = strpad('v71 in component v71 (flux)');
LEGEND_STATES(:,23) = strpad('c23 in component c23 (molecules)');
LEGEND_ALGEBRAIC(:,24) = strpad('v17 in component v17 (flux)');
LEGEND_STATES(:,24) = strpad('c24 in component c24 (molecules)');
LEGEND_ALGEBRAIC(:,77) = strpad('v72 in component v72 (flux)');
LEGEND_ALGEBRAIC(:,32) = strpad('v25 in component v25 (flux)');
LEGEND_ALGEBRAIC(:,47) = strpad('v40 in component v40 (flux)');
LEGEND_STATES(:,25) = strpad('c25 in component c25 (molecules)');
LEGEND_ALGEBRAIC(:,25) = strpad('v18 in component v18 (flux)');
LEGEND_ALGEBRAIC(:,26) = strpad('v19 in component v19 (flux)');
LEGEND_ALGEBRAIC(:,27) = strpad('v20 in component v20 (flux)');
LEGEND_ALGEBRAIC(:,28) = strpad('v21 in component v21 (flux)');
LEGEND_STATES(:,26) = strpad('c26 in component c26 (molecules)');
LEGEND_ALGEBRAIC(:,33) = strpad('v26 in component v26 (flux)');
LEGEND_ALGEBRAIC(:,38) = strpad('v31 in component v31 (flux)');
LEGEND_ALGEBRAIC(:,84) = strpad('v78 in component v78 (flux)');
LEGEND_ALGEBRAIC(:,78) = strpad('v73 in component v73 (flux)');
LEGEND_STATES(:,27) = strpad('c27 in component c27 (molecules)');
LEGEND_STATES(:,28) = strpad('c28 in component c28 (molecules)');
LEGEND_ALGEBRAIC(:,34) = strpad('v27 in component v27 (flux)');
LEGEND_ALGEBRAIC(:,35) = strpad('v28 in component v28 (flux)');
LEGEND_STATES(:,29) = strpad('c29 in component c29 (molecules)');
LEGEND_STATES(:,30) = strpad('c30 in component c30 (molecules)');
LEGEND_ALGEBRAIC(:,40) = strpad('v33 in component v33 (flux)');
LEGEND_ALGEBRAIC(:,48) = strpad('v41 in component v41 (flux)');
LEGEND_ALGEBRAIC(:,95) = strpad('v83 in component v83 (flux)');
LEGEND_STATES(:,31) = strpad('c31 in component c31 (molecules)');
LEGEND_ALGEBRAIC(:,43) = strpad('v36 in component v36 (flux)');
LEGEND_STATES(:,32) = strpad('c32 in component c32 (molecules)');
LEGEND_ALGEBRAIC(:,30) = strpad('v23 in component v23 (flux)');
LEGEND_ALGEBRAIC(:,76) = strpad('v103 in component v103 (flux)');
LEGEND_STATES(:,33) = strpad('c33 in component c33 (molecules)');
LEGEND_ALGEBRAIC(:,100) = strpad('v104 in component v104 (flux)');
LEGEND_STATES(:,34) = strpad('c34 in component c34 (molecules)');
LEGEND_ALGEBRAIC(:,114) = strpad('v114 in component v114 (flux)');
LEGEND_STATES(:,35) = strpad('c35 in component c35 (molecules)');
LEGEND_ALGEBRAIC(:,37) = strpad('v30 in component v30 (flux)');
LEGEND_ALGEBRAIC(:,117) = strpad('v117 in component v117 (flux)');
LEGEND_STATES(:,36) = strpad('c36 in component c36 (molecules)');
LEGEND_ALGEBRAIC(:,119) = strpad('v120 in component v120 (flux)');
LEGEND_STATES(:,37) = strpad('c37 in component c37 (molecules)');
LEGEND_ALGEBRAIC(:,121) = strpad('v123 in component v123 (flux)');
LEGEND_STATES(:,38) = strpad('c38 in component c38 (molecules)');
LEGEND_STATES(:,39) = strpad('c39 in component c39 (molecules)');
LEGEND_STATES(:,40) = strpad('c40 in component c40 (molecules)');
LEGEND_STATES(:,41) = strpad('c41 in component c41 (molecules)');
LEGEND_ALGEBRAIC(:,50) = strpad('v43 in component v43 (flux)');
LEGEND_ALGEBRAIC(:,80) = strpad('v75 in component v75 (flux)');
LEGEND_ALGEBRAIC(:,85) = strpad('v85 in component v85 (flux)');
LEGEND_STATES(:,42) = strpad('c42 in component c42 (molecules)');
LEGEND_ALGEBRAIC(:,36) = strpad('v29 in component v29 (flux)');
LEGEND_STATES(:,43) = strpad('c43 in component c43 (molecules)');
LEGEND_STATES(:,44) = strpad('c44 in component c44 (molecules)');
LEGEND_ALGEBRAIC(:,49) = strpad('v42 in component v42 (flux)');
LEGEND_ALGEBRAIC(:,83) = strpad('v84 in component v84 (flux)');
LEGEND_STATES(:,45) = strpad('c45 in component c45 (molecules)');
LEGEND_ALGEBRAIC(:,51) = strpad('v44 in component v44 (flux)');
LEGEND_ALGEBRAIC(:,52) = strpad('v45 in component v45 (flux)');
LEGEND_ALGEBRAIC(:,53) = strpad('v46 in component v46 (flux)');
LEGEND_ALGEBRAIC(:,54) = strpad('v47 in component v47 (flux)');
LEGEND_STATES(:,46) = strpad('c46 in component c46 (molecules)');
LEGEND_STATES(:,47) = strpad('c47 in component c47 (molecules)');
LEGEND_ALGEBRAIC(:,58) = strpad('v51 in component v51 (flux)');
LEGEND_ALGEBRAIC(:,86) = strpad('v86 in component v86 (flux)');
LEGEND_ALGEBRAIC(:,104) = strpad('v93 in component v93 (flux)');
LEGEND_STATES(:,48) = strpad('c48 in component c48 (molecules)');
LEGEND_STATES(:,49) = strpad('c49 in component c49 (molecules)');
LEGEND_ALGEBRAIC(:,56) = strpad('v49 in component v49 (flux)');
LEGEND_ALGEBRAIC(:,57) = strpad('v50 in component v50 (flux)');
LEGEND_STATES(:,50) = strpad('c50 in component c50 (molecules)');
LEGEND_STATES(:,51) = strpad('c51 in component c51 (molecules)');
LEGEND_ALGEBRAIC(:,55) = strpad('v48 in component v48 (flux)');
LEGEND_ALGEBRAIC(:,59) = strpad('v52 in component v52 (flux)');
LEGEND_ALGEBRAIC(:,60) = strpad('v53 in component v53 (flux)');
LEGEND_ALGEBRAIC(:,61) = strpad('v54 in component v54 (flux)');
LEGEND_ALGEBRAIC(:,62) = strpad('v55 in component v55 (flux)');
LEGEND_STATES(:,52) = strpad('c52 in component c52 (molecules)');
LEGEND_STATES(:,53) = strpad('c53 in component c53 (molecules)');
LEGEND_ALGEBRAIC(:,94) = strpad('v90 in component v90 (flux)');
LEGEND_ALGEBRAIC(:,97) = strpad('v91 in component v91 (flux)');
LEGEND_ALGEBRAIC(:,101) = strpad('v92 in component v92 (flux)');
LEGEND_STATES(:,54) = strpad('c54 in component c54 (molecules)');
LEGEND_STATES(:,55) = strpad('c55 in component c55 (molecules)');
LEGEND_ALGEBRAIC(:,66) = strpad('v59 in component v59 (flux)');
LEGEND_ALGEBRAIC(:,98) = strpad('v94 in component v94 (flux)');
LEGEND_ALGEBRAIC(:,115) = strpad('v101 in component v101 (flux)');
LEGEND_STATES(:,56) = strpad('c56 in component c56 (molecules)');
LEGEND_STATES(:,57) = strpad('c57 in component c57 (molecules)');
LEGEND_ALGEBRAIC(:,64) = strpad('v57 in component v57 (flux)');
LEGEND_ALGEBRAIC(:,65) = strpad('v58 in component v58 (flux)');
LEGEND_STATES(:,58) = strpad('c58 in component c58 (molecules)');
LEGEND_STATES(:,59) = strpad('c59 in component c59 (molecules)');
LEGEND_ALGEBRAIC(:,63) = strpad('v56 in component v56 (flux)');
LEGEND_STATES(:,60) = strpad('c60 in component c60 (molecules)');
LEGEND_ALGEBRAIC(:,109) = strpad('v98 in component v98 (flux)');
LEGEND_ALGEBRAIC(:,111) = strpad('v99 in component v99 (flux)');
LEGEND_ALGEBRAIC(:,113) = strpad('v100 in component v100 (flux)');
LEGEND_STATES(:,61) = strpad('c61 in component c61 (molecules)');
LEGEND_STATES(:,62) = strpad('c62 in component c62 (molecules)');
LEGEND_STATES(:,63) = strpad('c63 in component c63 (molecules)');
LEGEND_ALGEBRAIC(:,74) = strpad('v70 in component v70 (flux)');
LEGEND_STATES(:,64) = strpad('c64 in component c64 (molecules)');
LEGEND_STATES(:,65) = strpad('c65 in component c65 (molecules)');
LEGEND_STATES(:,66) = strpad('c66 in component c66 (molecules)');
LEGEND_ALGEBRAIC(:,79) = strpad('v74 in component v74 (flux)');
LEGEND_ALGEBRAIC(:,82) = strpad('v77 in component v77 (flux)');
LEGEND_STATES(:,67) = strpad('c67 in component c67 (molecules)');
LEGEND_STATES(:,68) = strpad('c68 in component c68 (molecules)');
LEGEND_STATES(:,69) = strpad('c69 in component c69 (molecules)');
LEGEND_STATES(:,70) = strpad('c70 in component c70 (molecules)');
LEGEND_ALGEBRAIC(:,81) = strpad('v76 in component v76 (flux)');
LEGEND_STATES(:,71) = strpad('c71 in component c71 (molecules)');
LEGEND_STATES(:,72) = strpad('c72 in component c72 (molecules)');
LEGEND_ALGEBRAIC(:,88) = strpad('v87 in component v87 (flux)');
LEGEND_ALGEBRAIC(:,90) = strpad('v88 in component v88 (flux)');
LEGEND_ALGEBRAIC(:,92) = strpad('v89 in component v89 (flux)');
LEGEND_STATES(:,73) = strpad('c73 in component c73 (molecules)');
LEGEND_STATES(:,74) = strpad('c74 in component c74 (molecules)');
LEGEND_STATES(:,75) = strpad('c75 in component c75 (molecules)');
LEGEND_STATES(:,76) = strpad('c76 in component c76 (molecules)');
LEGEND_STATES(:,77) = strpad('c77 in component c77 (molecules)');
LEGEND_ALGEBRAIC(:,102) = strpad('v95 in component v95 (flux)');
LEGEND_ALGEBRAIC(:,105) = strpad('v96 in component v96 (flux)');
LEGEND_ALGEBRAIC(:,107) = strpad('v97 in component v97 (flux)');
LEGEND_STATES(:,78) = strpad('c78 in component c78 (molecules)');
LEGEND_STATES(:,79) = strpad('c79 in component c79 (molecules)');
LEGEND_STATES(:,80) = strpad('c80 in component c80 (molecules)');
LEGEND_STATES(:,81) = strpad('c81 in component c81 (molecules)');
LEGEND_STATES(:,82) = strpad('c82 in component c82 (molecules)');
LEGEND_STATES(:,83) = strpad('c83 in component c83 (molecules)');
LEGEND_STATES(:,84) = strpad('c84 in component c84 (molecules)');
LEGEND_STATES(:,85) = strpad('c85 in component c85 (molecules)');
LEGEND_STATES(:,86) = strpad('c86 in component c86 (molecules)');
LEGEND_STATES(:,87) = strpad('c87 in component c87 (molecules)');
LEGEND_STATES(:,88) = strpad('c88 in component c88 (molecules)');
LEGEND_STATES(:,89) = strpad('c89 in component c89 (molecules)');
LEGEND_STATES(:,90) = strpad('c90 in component c90 (molecules)');
LEGEND_STATES(:,91) = strpad('c91 in component c91 (molecules)');
LEGEND_STATES(:,92) = strpad('c92 in component c92 (molecules)');
LEGEND_STATES(:,93) = strpad('c93 in component c93 (molecules)');
LEGEND_STATES(:,94) = strpad('c94 in component c94 (molecules)');
LEGEND_ALGEBRAIC(:,2) = strpad('Raf_activation in component Raf_activation (molecules)');
LEGEND_ALGEBRAIC(:,3) = strpad('MEKPP_total in component MEKPP_total (molecules)');
LEGEND_ALGEBRAIC(:,4) = strpad('ERKPP_total in component ERKPP_total (molecules)');
LEGEND_ALGEBRAIC(:,5) = strpad('Ras_GTP_total in component Ras_GTP_total (molecules)');
LEGEND_ALGEBRAIC(:,6) = strpad('ShcP_total in component ShcP_total (molecules)');
LEGEND_ALGEBRAIC(:,7) = strpad('EGF_EGFR_totalx2 in component EGF_EGFR_totalx2 (molecules)');
LEGEND_CONSTANTS(:,1) = strpad('k1 in component reaction_rates (second_order_rate_constant)');
LEGEND_CONSTANTS(:,2) = strpad('kd1 in component reaction_rates (first_order_rate_constant)');
LEGEND_CONSTANTS(:,3) = strpad('k2 in component reaction_rates (second_order_rate_constant)');
LEGEND_CONSTANTS(:,4) = strpad('kd2 in component reaction_rates (first_order_rate_constant)');
LEGEND_CONSTANTS(:,5) = strpad('k3 in component reaction_rates (first_order_rate_constant)');
LEGEND_CONSTANTS(:,6) = strpad('kd3 in component reaction_rates (first_order_rate_constant)');
LEGEND_CONSTANTS(:,7) = strpad('k4 in component reaction_rates (second_order_rate_constant)');
LEGEND_CONSTANTS(:,8) = strpad('kd4 in component reaction_rates (first_order_rate_constant)');
LEGEND_ALGEBRAIC(:,124) = strpad('k5 in component reaction_rates (first_order_rate_constant)');
LEGEND_CONSTANTS(:,9) = strpad('k6 in component reaction_rates (first_order_rate_constant)');
LEGEND_CONSTANTS(:,10) = strpad('kd6 in component reaction_rates (first_order_rate_constant)');
LEGEND_CONSTANTS(:,11) = strpad('k8 in component reaction_rates (second_order_rate_constant)');
LEGEND_CONSTANTS(:,12) = strpad('kd8 in component reaction_rates (first_order_rate_constant)');
LEGEND_CONSTANTS(:,13) = strpad('k10b in component reaction_rates (second_order_rate_constant)');
LEGEND_CONSTANTS(:,14) = strpad('kd10 in component reaction_rates (first_order_rate_constant)');
LEGEND_CONSTANTS(:,15) = strpad('k13 in component reaction_rates (first_order_rate_constant)');
LEGEND_CONSTANTS(:,16) = strpad('k15 in component reaction_rates (first_order_rate_constant)');
LEGEND_CONSTANTS(:,17) = strpad('k16 in component reaction_rates (second_order_rate_constant)');
LEGEND_CONSTANTS(:,18) = strpad('kd16 in component reaction_rates (first_order_rate_constant)');
LEGEND_CONSTANTS(:,19) = strpad('k17 in component reaction_rates (second_order_rate_constant)');
LEGEND_CONSTANTS(:,20) = strpad('kd17 in component reaction_rates (first_order_rate_constant)');
LEGEND_CONSTANTS(:,21) = strpad('k18 in component reaction_rates (second_order_rate_constant)');
LEGEND_CONSTANTS(:,22) = strpad('kd18 in component reaction_rates (first_order_rate_constant)');
LEGEND_CONSTANTS(:,23) = strpad('k19 in component reaction_rates (first_order_rate_constant)');
LEGEND_CONSTANTS(:,24) = strpad('kd19 in component reaction_rates (second_order_rate_constant)');
LEGEND_CONSTANTS(:,25) = strpad('k20 in component reaction_rates (second_order_rate_constant)');
LEGEND_CONSTANTS(:,26) = strpad('kd20 in component reaction_rates (first_order_rate_constant)');
LEGEND_CONSTANTS(:,27) = strpad('k21 in component reaction_rates (first_order_rate_constant)');
LEGEND_CONSTANTS(:,28) = strpad('kd21 in component reaction_rates (second_order_rate_constant)');
LEGEND_CONSTANTS(:,29) = strpad('k22 in component reaction_rates (second_order_rate_constant)');
LEGEND_CONSTANTS(:,30) = strpad('kd22 in component reaction_rates (first_order_rate_constant)');
LEGEND_CONSTANTS(:,31) = strpad('k23 in component reaction_rates (first_order_rate_constant)');
LEGEND_CONSTANTS(:,32) = strpad('kd23 in component reaction_rates (first_order_rate_constant)');
LEGEND_CONSTANTS(:,33) = strpad('kd24 in component reaction_rates (first_order_rate_constant)');
LEGEND_CONSTANTS(:,34) = strpad('k25 in component reaction_rates (second_order_rate_constant)');
LEGEND_CONSTANTS(:,35) = strpad('kd25 in component reaction_rates (first_order_rate_constant)');
LEGEND_CONSTANTS(:,36) = strpad('k28 in component reaction_rates (second_order_rate_constant)');
LEGEND_CONSTANTS(:,37) = strpad('kd28 in component reaction_rates (first_order_rate_constant)');
LEGEND_CONSTANTS(:,38) = strpad('k29 in component reaction_rates (first_order_rate_constant)');
LEGEND_CONSTANTS(:,39) = strpad('kd29 in component reaction_rates (second_order_rate_constant)');
LEGEND_CONSTANTS(:,40) = strpad('k32 in component reaction_rates (first_order_rate_constant)');
LEGEND_CONSTANTS(:,41) = strpad('kd32 in component reaction_rates (second_order_rate_constant)');
LEGEND_CONSTANTS(:,42) = strpad('k33 in component reaction_rates (first_order_rate_constant)');
LEGEND_CONSTANTS(:,43) = strpad('kd33 in component reaction_rates (second_order_rate_constant)');
LEGEND_CONSTANTS(:,44) = strpad('k34 in component reaction_rates (first_order_rate_constant)');
LEGEND_CONSTANTS(:,45) = strpad('kd34 in component reaction_rates (second_order_rate_constant)');
LEGEND_CONSTANTS(:,46) = strpad('k35 in component reaction_rates (first_order_rate_constant)');
LEGEND_CONSTANTS(:,47) = strpad('kd35 in component reaction_rates (second_order_rate_constant)');
LEGEND_CONSTANTS(:,48) = strpad('Km36 in component reaction_rates (molecules)');
LEGEND_CONSTANTS(:,49) = strpad('Vm36 in component reaction_rates (flux)');
LEGEND_CONSTANTS(:,50) = strpad('k37 in component reaction_rates (first_order_rate_constant)');
LEGEND_CONSTANTS(:,51) = strpad('kd37 in component reaction_rates (second_order_rate_constant)');
LEGEND_CONSTANTS(:,52) = strpad('k40 in component reaction_rates (second_order_rate_constant)');
LEGEND_CONSTANTS(:,53) = strpad('kd40 in component reaction_rates (first_order_rate_constant)');
LEGEND_CONSTANTS(:,54) = strpad('k41 in component reaction_rates (second_order_rate_constant)');
LEGEND_CONSTANTS(:,55) = strpad('kd41 in component reaction_rates (first_order_rate_constant)');
LEGEND_CONSTANTS(:,56) = strpad('k42 in component reaction_rates (second_order_rate_constant)');
LEGEND_CONSTANTS(:,57) = strpad('kd42 in component reaction_rates (first_order_rate_constant)');
LEGEND_CONSTANTS(:,58) = strpad('k43 in component reaction_rates (first_order_rate_constant)');
LEGEND_CONSTANTS(:,59) = strpad('k44 in component reaction_rates (second_order_rate_constant)');
LEGEND_CONSTANTS(:,60) = strpad('kd44 in component reaction_rates (first_order_rate_constant)');
LEGEND_CONSTANTS(:,61) = strpad('k45 in component reaction_rates (first_order_rate_constant)');
LEGEND_CONSTANTS(:,62) = strpad('k47 in component reaction_rates (first_order_rate_constant)');
LEGEND_CONSTANTS(:,63) = strpad('k48 in component reaction_rates (second_order_rate_constant)');
LEGEND_CONSTANTS(:,64) = strpad('kd48 in component reaction_rates (first_order_rate_constant)');
LEGEND_CONSTANTS(:,65) = strpad('k49 in component reaction_rates (first_order_rate_constant)');
LEGEND_CONSTANTS(:,66) = strpad('k50 in component reaction_rates (second_order_rate_constant)');
LEGEND_CONSTANTS(:,67) = strpad('kd50 in component reaction_rates (first_order_rate_constant)');
LEGEND_CONSTANTS(:,68) = strpad('k52 in component reaction_rates (second_order_rate_constant)');
LEGEND_CONSTANTS(:,69) = strpad('kd52 in component reaction_rates (first_order_rate_constant)');
LEGEND_CONSTANTS(:,70) = strpad('k53 in component reaction_rates (first_order_rate_constant)');
LEGEND_CONSTANTS(:,71) = strpad('k55 in component reaction_rates (first_order_rate_constant)');
LEGEND_CONSTANTS(:,72) = strpad('k56 in component reaction_rates (second_order_rate_constant)');
LEGEND_CONSTANTS(:,73) = strpad('kd56 in component reaction_rates (first_order_rate_constant)');
LEGEND_CONSTANTS(:,74) = strpad('k57 in component reaction_rates (first_order_rate_constant)');
LEGEND_CONSTANTS(:,75) = strpad('k58 in component reaction_rates (second_order_rate_constant)');
LEGEND_CONSTANTS(:,76) = strpad('kd58 in component reaction_rates (first_order_rate_constant)');
LEGEND_CONSTANTS(:,77) = strpad('k59 in component reaction_rates (first_order_rate_constant)');
LEGEND_CONSTANTS(:,78) = strpad('k60 in component reaction_rates (first_order_rate_constant)');
LEGEND_CONSTANTS(:,79) = strpad('k61 in component reaction_rates (first_order_rate_constant)');
LEGEND_ALGEBRAIC(:,123) = strpad('C in component C (flux)');
LEGEND_CONSTANTS(:,80) = strpad('RT in component C (molecules)');
LEGEND_RATES(:,1) = strpad('d/dt c1 in component c1 (molecules)');
LEGEND_RATES(:,2) = strpad('d/dt c2 in component c2 (molecules)');
LEGEND_RATES(:,3) = strpad('d/dt c3 in component c3 (molecules)');
LEGEND_RATES(:,4) = strpad('d/dt c4 in component c4 (molecules)');
LEGEND_RATES(:,5) = strpad('d/dt c5 in component c5 (molecules)');
LEGEND_RATES(:,6) = strpad('d/dt c6 in component c6 (molecules)');
LEGEND_RATES(:,7) = strpad('d/dt c7 in component c7 (molecules)');
LEGEND_RATES(:,8) = strpad('d/dt c8 in component c8 (molecules)');
LEGEND_RATES(:,9) = strpad('d/dt c9 in component c9 (molecules)');
LEGEND_RATES(:,10) = strpad('d/dt c10 in component c10 (molecules)');
LEGEND_RATES(:,11) = strpad('d/dt c11 in component c11 (molecules)');
LEGEND_RATES(:,12) = strpad('d/dt c12 in component c12 (molecules)');
LEGEND_RATES(:,13) = strpad('d/dt c13 in component c13 (molecules)');
LEGEND_RATES(:,14) = strpad('d/dt c14 in component c14 (molecules)');
LEGEND_RATES(:,15) = strpad('d/dt c15 in component c15 (molecules)');
LEGEND_RATES(:,16) = strpad('d/dt c16 in component c16 (molecules)');
LEGEND_RATES(:,17) = strpad('d/dt c17 in component c17 (molecules)');
LEGEND_RATES(:,18) = strpad('d/dt c18 in component c18 (molecules)');
LEGEND_RATES(:,19) = strpad('d/dt c19 in component c19 (molecules)');
LEGEND_RATES(:,20) = strpad('d/dt c20 in component c20 (molecules)');
LEGEND_RATES(:,21) = strpad('d/dt c21 in component c21 (molecules)');
LEGEND_RATES(:,22) = strpad('d/dt c22 in component c22 (molecules)');
LEGEND_RATES(:,23) = strpad('d/dt c23 in component c23 (molecules)');
LEGEND_RATES(:,24) = strpad('d/dt c24 in component c24 (molecules)');
LEGEND_RATES(:,25) = strpad('d/dt c25 in component c25 (molecules)');
LEGEND_RATES(:,26) = strpad('d/dt c26 in component c26 (molecules)');
LEGEND_RATES(:,27) = strpad('d/dt c27 in component c27 (molecules)');
LEGEND_RATES(:,28) = strpad('d/dt c28 in component c28 (molecules)');
LEGEND_RATES(:,29) = strpad('d/dt c29 in component c29 (molecules)');
LEGEND_RATES(:,30) = strpad('d/dt c30 in component c30 (molecules)');
LEGEND_RATES(:,31) = strpad('d/dt c31 in component c31 (molecules)');
LEGEND_RATES(:,32) = strpad('d/dt c32 in component c32 (molecules)');
LEGEND_RATES(:,33) = strpad('d/dt c33 in component c33 (molecules)');
LEGEND_RATES(:,34) = strpad('d/dt c34 in component c34 (molecules)');
LEGEND_RATES(:,35) = strpad('d/dt c35 in component c35 (molecules)');
LEGEND_RATES(:,36) = strpad('d/dt c36 in component c36 (molecules)');
LEGEND_RATES(:,37) = strpad('d/dt c37 in component c37 (molecules)');
LEGEND_RATES(:,38) = strpad('d/dt c38 in component c38 (molecules)');
LEGEND_RATES(:,39) = strpad('d/dt c39 in component c39 (molecules)');
LEGEND_RATES(:,40) = strpad('d/dt c40 in component c40 (molecules)');
LEGEND_RATES(:,41) = strpad('d/dt c41 in component c41 (molecules)');
LEGEND_RATES(:,42) = strpad('d/dt c42 in component c42 (molecules)');
LEGEND_RATES(:,43) = strpad('d/dt c43 in component c43 (molecules)');
LEGEND_RATES(:,44) = strpad('d/dt c44 in component c44 (molecules)');
LEGEND_RATES(:,45) = strpad('d/dt c45 in component c45 (molecules)');
LEGEND_RATES(:,46) = strpad('d/dt c46 in component c46 (molecules)');
LEGEND_RATES(:,47) = strpad('d/dt c47 in component c47 (molecules)');
LEGEND_RATES(:,48) = strpad('d/dt c48 in component c48 (molecules)');
LEGEND_RATES(:,49) = strpad('d/dt c49 in component c49 (molecules)');
LEGEND_RATES(:,50) = strpad('d/dt c50 in component c50 (molecules)');
LEGEND_RATES(:,51) = strpad('d/dt c51 in component c51 (molecules)');
LEGEND_RATES(:,52) = strpad('d/dt c52 in component c52 (molecules)');
LEGEND_RATES(:,53) = strpad('d/dt c53 in component c53 (molecules)');
LEGEND_RATES(:,54) = strpad('d/dt c54 in component c54 (molecules)');
LEGEND_RATES(:,55) = strpad('d/dt c55 in component c55 (molecules)');
LEGEND_RATES(:,56) = strpad('d/dt c56 in component c56 (molecules)');
LEGEND_RATES(:,57) = strpad('d/dt c57 in component c57 (molecules)');
LEGEND_RATES(:,58) = strpad('d/dt c58 in component c58 (molecules)');
LEGEND_RATES(:,59) = strpad('d/dt c59 in component c59 (molecules)');
LEGEND_RATES(:,60) = strpad('d/dt c60 in component c60 (molecules)');
LEGEND_RATES(:,61) = strpad('d/dt c61 in component c61 (molecules)');
LEGEND_RATES(:,62) = strpad('d/dt c62 in component c62 (molecules)');
LEGEND_RATES(:,63) = strpad('d/dt c63 in component c63 (molecules)');
LEGEND_RATES(:,64) = strpad('d/dt c64 in component c64 (molecules)');
LEGEND_RATES(:,65) = strpad('d/dt c65 in component c65 (molecules)');
LEGEND_RATES(:,66) = strpad('d/dt c66 in component c66 (molecules)');
LEGEND_RATES(:,67) = strpad('d/dt c67 in component c67 (molecules)');
LEGEND_RATES(:,68) = strpad('d/dt c68 in component c68 (molecules)');
LEGEND_RATES(:,69) = strpad('d/dt c69 in component c69 (molecules)');
LEGEND_RATES(:,70) = strpad('d/dt c70 in component c70 (molecules)');
LEGEND_RATES(:,71) = strpad('d/dt c71 in component c71 (molecules)');
LEGEND_RATES(:,72) = strpad('d/dt c72 in component c72 (molecules)');
LEGEND_RATES(:,73) = strpad('d/dt c73 in component c73 (molecules)');
LEGEND_RATES(:,74) = strpad('d/dt c74 in component c74 (molecules)');
LEGEND_RATES(:,75) = strpad('d/dt c75 in component c75 (molecules)');
LEGEND_RATES(:,76) = strpad('d/dt c76 in component c76 (molecules)');
LEGEND_RATES(:,77) = strpad('d/dt c77 in component c77 (molecules)');
LEGEND_RATES(:,78) = strpad('d/dt c78 in component c78 (molecules)');
LEGEND_RATES(:,79) = strpad('d/dt c79 in component c79 (molecules)');
LEGEND_RATES(:,80) = strpad('d/dt c80 in component c80 (molecules)');
LEGEND_RATES(:,81) = strpad('d/dt c81 in component c81 (molecules)');
LEGEND_RATES(:,82) = strpad('d/dt c82 in component c82 (molecules)');
LEGEND_RATES(:,83) = strpad('d/dt c83 in component c83 (molecules)');
LEGEND_RATES(:,84) = strpad('d/dt c84 in component c84 (molecules)');
LEGEND_RATES(:,85) = strpad('d/dt c85 in component c85 (molecules)');
LEGEND_RATES(:,86) = strpad('d/dt c86 in component c86 (molecules)');
LEGEND_RATES(:,87) = strpad('d/dt c87 in component c87 (molecules)');
LEGEND_RATES(:,88) = strpad('d/dt c88 in component c88 (molecules)');
LEGEND_RATES(:,89) = strpad('d/dt c89 in component c89 (molecules)');
LEGEND_RATES(:,90) = strpad('d/dt c90 in component c90 (molecules)');
LEGEND_RATES(:,91) = strpad('d/dt c91 in component c91 (molecules)');
LEGEND_RATES(:,92) = strpad('d/dt c92 in component c92 (molecules)');
LEGEND_RATES(:,93) = strpad('d/dt c93 in component c93 (molecules)');
LEGEND_RATES(:,94) = strpad('d/dt c94 in component c94 (molecules)');
LEGEND_STATES  = LEGEND_STATES';
LEGEND_ALGEBRAIC = LEGEND_ALGEBRAIC';
LEGEND_RATES = LEGEND_RATES';
LEGEND_CONSTANTS = LEGEND_CONSTANTS';
end

function [STATES, CONSTANTS] = initConsts()
VOI = 0; CONSTANTS = []; STATES = []; ALGEBRAIC = [];
STATES(:,1) = 4962;
STATES(:,2) = 5e4;
STATES(:,3) = 0;
STATES(:,4) = 0;
STATES(:,5) = 0;
STATES(:,6) = 0;
STATES(:,7) = 0;
STATES(:,8) = 0;
STATES(:,9) = 0;
STATES(:,10) = 0;
STATES(:,11) = 0;
STATES(:,12) = 8.1e4;
STATES(:,13) = 0;
STATES(:,14) = 1.2e4;
STATES(:,15) = 0;
STATES(:,16) = 0;
STATES(:,17) = 0;
STATES(:,18) = 0;
STATES(:,19) = 0;
STATES(:,20) = 0;
STATES(:,21) = 0;
STATES(:,22) = 1.1e4;
STATES(:,23) = 0;
STATES(:,24) = 2.63e4;
STATES(:,25) = 0;
STATES(:,26) = 7.2e4;
STATES(:,27) = 0;
STATES(:,28) = 0;
STATES(:,29) = 0;
STATES(:,30) = 4e4;
STATES(:,31) = 1.01e5;
STATES(:,32) = 0;
STATES(:,33) = 0;
STATES(:,34) = 0;
STATES(:,35) = 0;
STATES(:,36) = 0;
STATES(:,37) = 0;
STATES(:,38) = 0;
STATES(:,39) = 0;
STATES(:,40) = 0;
STATES(:,41) = 4e4;
STATES(:,42) = 0;
STATES(:,43) = 0;
STATES(:,44) = 4e4;
STATES(:,45) = 0;
STATES(:,46) = 0;
STATES(:,47) = 2.2e7;
STATES(:,48) = 0;
STATES(:,49) = 0;
STATES(:,50) = 0;
STATES(:,51) = 0;
STATES(:,52) = 0;
STATES(:,53) = 4e4;
STATES(:,54) = 0;
STATES(:,55) = 2.1e7;
STATES(:,56) = 0;
STATES(:,57) = 0;
STATES(:,58) = 0;
STATES(:,59) = 0;
STATES(:,60) = 1e7;
STATES(:,61) = 0;
STATES(:,62) = 0;
STATES(:,63) = 0;
STATES(:,64) = 0;
STATES(:,65) = 0;
STATES(:,66) = 0;
STATES(:,67) = 0;
STATES(:,68) = 0;
STATES(:,69) = 0;
STATES(:,70) = 0;
STATES(:,71) = 0;
STATES(:,72) = 0;
STATES(:,73) = 0;
STATES(:,74) = 0;
STATES(:,75) = 0;
STATES(:,76) = 0;
STATES(:,77) = 0;
STATES(:,78) = 0;
STATES(:,79) = 0;
STATES(:,80) = 0;
STATES(:,81) = 0;
STATES(:,82) = 0;
STATES(:,83) = 0;
STATES(:,84) = 0;
STATES(:,85) = 0;
STATES(:,86) = 0;
STATES(:,87) = 0;
STATES(:,88) = 0;
STATES(:,89) = 0;
STATES(:,90) = 0;
STATES(:,91) = 0;
STATES(:,92) = 0;
STATES(:,93) = 0;
STATES(:,94) = 0;
CONSTANTS(:,1) = 3e-3;
CONSTANTS(:,2) = 0.228;
CONSTANTS(:,3) = 1e-3;
CONSTANTS(:,4) = 6;
CONSTANTS(:,5) = 60;
CONSTANTS(:,6) = 0.6;
CONSTANTS(:,7) = 1.038e-5;
CONSTANTS(:,8) = 0.0996;
CONSTANTS(:,9) = 3e-3;
CONSTANTS(:,10) = 0.3;
CONSTANTS(:,11) = 1e-4;
CONSTANTS(:,12) = 12;
CONSTANTS(:,13) = 3.25581;
CONSTANTS(:,14) = 0.66;
CONSTANTS(:,15) = 130.2;
CONSTANTS(:,16) = 600000;
CONSTANTS(:,17) = 0.001;
CONSTANTS(:,18) = 16.5;
CONSTANTS(:,19) = 0.001;
CONSTANTS(:,20) = 3.6;
CONSTANTS(:,21) = 0.0015;
CONSTANTS(:,22) = 78;
CONSTANTS(:,23) = 30;
CONSTANTS(:,24) = 1e-5;
CONSTANTS(:,25) = 2.1e-4;
CONSTANTS(:,26) = 24;
CONSTANTS(:,27) = 1.38;
CONSTANTS(:,28) = 2.2e-5;
CONSTANTS(:,29) = 0.0021;
CONSTANTS(:,30) = 6;
CONSTANTS(:,31) = 360;
CONSTANTS(:,32) = 36;
CONSTANTS(:,33) = 33;
CONSTANTS(:,34) = 0.001;
CONSTANTS(:,35) = 1.284;
CONSTANTS(:,36) = 1e-4;
CONSTANTS(:,37) = 0.318;
CONSTANTS(:,38) = 60;
CONSTANTS(:,39) = 7e-5;
CONSTANTS(:,40) = 6;
CONSTANTS(:,41) = 2.4e-5;
CONSTANTS(:,42) = 12;
CONSTANTS(:,43) = 0.0021;
CONSTANTS(:,44) = 1.8;
CONSTANTS(:,45) = 4.5e-4;
CONSTANTS(:,46) = 0.09;
CONSTANTS(:,47) = 4.5e-4;
CONSTANTS(:,48) = 2e14;
CONSTANTS(:,49) = 61200;
CONSTANTS(:,50) = 18;
CONSTANTS(:,51) = 9e-5;
CONSTANTS(:,52) = 0.003;
CONSTANTS(:,53) = 3.84;
CONSTANTS(:,54) = 0.003;
CONSTANTS(:,55) = 2.574;
CONSTANTS(:,56) = 0.007;
CONSTANTS(:,57) = 12;
CONSTANTS(:,58) = 60;
CONSTANTS(:,59) = 0.00111;
CONSTANTS(:,60) = 1.0998;
CONSTANTS(:,61) = 210;
CONSTANTS(:,62) = 174;
CONSTANTS(:,63) = 0.00143;
CONSTANTS(:,64) = 48;
CONSTANTS(:,65) = 3.48;
CONSTANTS(:,66) = 2.5e-5;
CONSTANTS(:,67) = 30;
CONSTANTS(:,68) = 0.00534;
CONSTANTS(:,69) = 1.98;
CONSTANTS(:,70) = 960;
CONSTANTS(:,71) = 342;
CONSTANTS(:,72) = 0.00145;
CONSTANTS(:,73) = 36;
CONSTANTS(:,74) = 16.2;
CONSTANTS(:,75) = 5e-4;
CONSTANTS(:,76) = 30;
CONSTANTS(:,77) = 18;
CONSTANTS(:,78) = 0.04002;
CONSTANTS(:,79) = 0.01002;
CONSTANTS(:,80) = 50000;
CONSTANTS(:,81) =  CONSTANTS(:,15).*1.00000;
CONSTANTS(:,81) = 0.00000;
if (isempty(STATES)), warning('Initial values for states not set');, end
end

function [RATES, ALGEBRAIC] = computeRates(VOI, STATES, CONSTANTS)
global algebraicVariableCount;
statesSize = size(STATES);
statesColumnCount = statesSize(2);
if ( statesColumnCount == 1)
STATES = STATES';
ALGEBRAIC = zeros(1, algebraicVariableCount);
utilOnes = 1;
else
statesRowCount = statesSize(1);
ALGEBRAIC = zeros(statesRowCount, algebraicVariableCount);
RATES = zeros(statesRowCount, statesColumnCount);
utilOnes = ones(statesRowCount, 1);
end
RATES(:,1) = CONSTANTS(:,81);
ALGEBRAIC(:,1) =  CONSTANTS(:,1).*STATES(:,1).*STATES(:,2) -  CONSTANTS(:,2).*STATES(:,3);
ALGEBRAIC(:,8) =  CONSTANTS(:,3).*STATES(:,3).*STATES(:,3) -  CONSTANTS(:,4).*STATES(:,4);
RATES(:,3) = ALGEBRAIC(:,1) -  2.00000.*ALGEBRAIC(:,8);
ALGEBRAIC(:,9) =  CONSTANTS(:,5).*STATES(:,4) -  CONSTANTS(:,6).*STATES(:,5);
RATES(:,4) = ALGEBRAIC(:,8) - ALGEBRAIC(:,9);
ALGEBRAIC(:,11) =  CONSTANTS(:,9).*STATES(:,2) -  CONSTANTS(:,10).*STATES(:,6);
RATES(:,2) = CONSTANTS(:,81) - (ALGEBRAIC(:,1)+ALGEBRAIC(:,11));
ALGEBRAIC(:,12) =  CONSTANTS(:,9).*STATES(:,5);
ALGEBRAIC(:,13) =  CONSTANTS(:,11).*STATES(:,5).*STATES(:,14) -  CONSTANTS(:,12).*STATES(:,15);
RATES(:,5) = ALGEBRAIC(:,9) - (ALGEBRAIC(:,12)+ALGEBRAIC(:,13));
ALGEBRAIC(:,15) =  CONSTANTS(:,13).*STATES(:,6).*STATES(:,16) -  CONSTANTS(:,14).*STATES(:,10);
ALGEBRAIC(:,16) =  CONSTANTS(:,78).*STATES(:,6);
RATES(:,6) = ALGEBRAIC(:,11) - (ALGEBRAIC(:,15)+ALGEBRAIC(:,16));
ALGEBRAIC(:,17) =  CONSTANTS(:,3).*STATES(:,10).*STATES(:,10) -  CONSTANTS(:,4).*STATES(:,11);
RATES(:,10) = ALGEBRAIC(:,15) -  2.00000.*ALGEBRAIC(:,17);
ALGEBRAIC(:,18) =  CONSTANTS(:,79).*STATES(:,16);
RATES(:,13) = ALGEBRAIC(:,18);
RATES(:,16) =  - (ALGEBRAIC(:,15)+ALGEBRAIC(:,18));
RATES(:,86) = ALGEBRAIC(:,16);
ALGEBRAIC(:,19) =  CONSTANTS(:,5).*STATES(:,11) -  CONSTANTS(:,6).*STATES(:,8);
RATES(:,11) = ALGEBRAIC(:,17) - ALGEBRAIC(:,19);
ALGEBRAIC(:,20) =  CONSTANTS(:,11).*STATES(:,8).*STATES(:,14) -  CONSTANTS(:,12).*STATES(:,17);
RATES(:,14) =  - (ALGEBRAIC(:,13)+ALGEBRAIC(:,20));
ALGEBRAIC(:,21) =  CONSTANTS(:,78).*STATES(:,8);
RATES(:,8) = (ALGEBRAIC(:,12)+ALGEBRAIC(:,19)) - (ALGEBRAIC(:,20)+ALGEBRAIC(:,21));
RATES(:,87) = ALGEBRAIC(:,21);
ALGEBRAIC(:,10) =  CONSTANTS(:,7).*STATES(:,23).*STATES(:,12) -  CONSTANTS(:,8).*STATES(:,7);
ALGEBRAIC(:,23) =  CONSTANTS(:,17).*STATES(:,22).*STATES(:,15) -  CONSTANTS(:,18).*STATES(:,23);
ALGEBRAIC(:,14) =  CONSTANTS(:,9).*STATES(:,23);
ALGEBRAIC(:,24) =  CONSTANTS(:,19).*STATES(:,24).*STATES(:,23) -  CONSTANTS(:,20).*STATES(:,25);
RATES(:,23) = ALGEBRAIC(:,23) - (ALGEBRAIC(:,10)+ALGEBRAIC(:,14)+ALGEBRAIC(:,24));
ALGEBRAIC(:,26) =  CONSTANTS(:,23).*STATES(:,27) -  CONSTANTS(:,24).*STATES(:,28).*STATES(:,25);
ALGEBRAIC(:,34) =  CONSTANTS(:,23).*STATES(:,36) -  CONSTANTS(:,24).*STATES(:,35).*STATES(:,28);
ALGEBRAIC(:,35) =  CONSTANTS(:,36).*STATES(:,28).*STATES(:,41) -  CONSTANTS(:,37).*STATES(:,42);
RATES(:,28) = (ALGEBRAIC(:,26)+ALGEBRAIC(:,34)) - ALGEBRAIC(:,35);
ALGEBRAIC(:,36) =  CONSTANTS(:,38).*STATES(:,42) -  CONSTANTS(:,39).*STATES(:,43).*STATES(:,45);
RATES(:,42) = ALGEBRAIC(:,35) - ALGEBRAIC(:,36);
ALGEBRAIC(:,27) =  CONSTANTS(:,25).*STATES(:,25).*STATES(:,43) -  CONSTANTS(:,26).*STATES(:,29);
ALGEBRAIC(:,37) =  CONSTANTS(:,25).*STATES(:,35).*STATES(:,43) -  CONSTANTS(:,26).*STATES(:,37);
RATES(:,43) = ALGEBRAIC(:,36) - (ALGEBRAIC(:,27)+ALGEBRAIC(:,37));
ALGEBRAIC(:,50) =  CONSTANTS(:,58).*STATES(:,46);
ALGEBRAIC(:,49) =  CONSTANTS(:,56).*STATES(:,44).*STATES(:,45) -  CONSTANTS(:,57).*STATES(:,46);
RATES(:,46) = ALGEBRAIC(:,49) - ALGEBRAIC(:,50);
ALGEBRAIC(:,51) =  CONSTANTS(:,59).*STATES(:,47).*STATES(:,45) -  CONSTANTS(:,60).*STATES(:,48);
ALGEBRAIC(:,52) =  CONSTANTS(:,61).*STATES(:,48);
RATES(:,48) = ALGEBRAIC(:,51) - ALGEBRAIC(:,52);
ALGEBRAIC(:,53) =  CONSTANTS(:,59).*STATES(:,49).*STATES(:,45) -  CONSTANTS(:,60).*STATES(:,50);
ALGEBRAIC(:,54) =  CONSTANTS(:,62).*STATES(:,50);
RATES(:,45) = (ALGEBRAIC(:,36)+ALGEBRAIC(:,52)+ALGEBRAIC(:,54)) - (ALGEBRAIC(:,49)+ALGEBRAIC(:,51)+ALGEBRAIC(:,53));
RATES(:,50) = ALGEBRAIC(:,53) - ALGEBRAIC(:,54);
ALGEBRAIC(:,56) =  CONSTANTS(:,65).*STATES(:,52);
ALGEBRAIC(:,55) =  CONSTANTS(:,63).*STATES(:,51).*STATES(:,53) -  CONSTANTS(:,64).*STATES(:,52);
RATES(:,52) = ALGEBRAIC(:,55) - ALGEBRAIC(:,56);
ALGEBRAIC(:,57) =  CONSTANTS(:,66).*STATES(:,53).*STATES(:,49) -  CONSTANTS(:,67).*STATES(:,54);
RATES(:,49) = (ALGEBRAIC(:,52)+ALGEBRAIC(:,56)) - (ALGEBRAIC(:,53)+ALGEBRAIC(:,57));
ALGEBRAIC(:,58) =  CONSTANTS(:,65).*STATES(:,54);
RATES(:,54) = ALGEBRAIC(:,57) - ALGEBRAIC(:,58);
ALGEBRAIC(:,59) =  CONSTANTS(:,68).*STATES(:,55).*STATES(:,51) -  CONSTANTS(:,69).*STATES(:,56);
ALGEBRAIC(:,60) =  CONSTANTS(:,70).*STATES(:,56);
RATES(:,56) = ALGEBRAIC(:,59) - ALGEBRAIC(:,60);
ALGEBRAIC(:,61) =  CONSTANTS(:,68).*STATES(:,51).*STATES(:,57) -  CONSTANTS(:,69).*STATES(:,58);
ALGEBRAIC(:,62) =  CONSTANTS(:,71).*STATES(:,58);
RATES(:,51) = (ALGEBRAIC(:,54)+ALGEBRAIC(:,60)+ALGEBRAIC(:,62)) - (ALGEBRAIC(:,55)+ALGEBRAIC(:,59)+ALGEBRAIC(:,61));
RATES(:,58) = ALGEBRAIC(:,61) - ALGEBRAIC(:,62);
ALGEBRAIC(:,63) =  CONSTANTS(:,72).*STATES(:,59).*STATES(:,60) -  CONSTANTS(:,73).*STATES(:,61);
RATES(:,59) = ALGEBRAIC(:,62) - ALGEBRAIC(:,63);
ALGEBRAIC(:,64) =  CONSTANTS(:,74).*STATES(:,61);
RATES(:,61) = ALGEBRAIC(:,63) - ALGEBRAIC(:,64);
ALGEBRAIC(:,65) =  CONSTANTS(:,75).*STATES(:,60).*STATES(:,57) -  CONSTANTS(:,76).*STATES(:,62);
RATES(:,57) = (ALGEBRAIC(:,60)+ALGEBRAIC(:,64)) - (ALGEBRAIC(:,61)+ALGEBRAIC(:,65));
ALGEBRAIC(:,66) =  CONSTANTS(:,77).*STATES(:,62);
RATES(:,62) = ALGEBRAIC(:,65) - ALGEBRAIC(:,66);
ALGEBRAIC(:,29) =  CONSTANTS(:,29).*STATES(:,31).*STATES(:,15) -  CONSTANTS(:,30).*STATES(:,32);
ALGEBRAIC(:,73) =  CONSTANTS(:,29).*STATES(:,31).*STATES(:,17) -  CONSTANTS(:,30).*STATES(:,63);
ALGEBRAIC(:,43) = ( CONSTANTS(:,49).*STATES(:,40))./(CONSTANTS(:,48)+STATES(:,40));
RATES(:,31) = ALGEBRAIC(:,43) - (ALGEBRAIC(:,29)+ALGEBRAIC(:,73));
ALGEBRAIC(:,67) =  CONSTANTS(:,17).*STATES(:,17).*STATES(:,22) -  CONSTANTS(:,18).*STATES(:,18);
ALGEBRAIC(:,31) =  CONSTANTS(:,17).*STATES(:,22).*STATES(:,33) -  CONSTANTS(:,33).*STATES(:,34);
ALGEBRAIC(:,42) =  CONSTANTS(:,46).*STATES(:,30) -  CONSTANTS(:,47).*STATES(:,24).*STATES(:,22);
ALGEBRAIC(:,45) =  CONSTANTS(:,17).*STATES(:,22).*STATES(:,40) -  CONSTANTS(:,33).*STATES(:,39);
ALGEBRAIC(:,75) =  CONSTANTS(:,17).*STATES(:,22).*STATES(:,64) -  CONSTANTS(:,33).*STATES(:,65);
RATES(:,22) = ALGEBRAIC(:,42) - (ALGEBRAIC(:,23)+ALGEBRAIC(:,31)+ALGEBRAIC(:,45)+ALGEBRAIC(:,67)+ALGEBRAIC(:,75));
ALGEBRAIC(:,30) =  CONSTANTS(:,31).*STATES(:,32) -  CONSTANTS(:,32).*STATES(:,33);
ALGEBRAIC(:,76) =  CONSTANTS(:,9).*STATES(:,32) -  CONSTANTS(:,10).*STATES(:,63);
RATES(:,32) = ALGEBRAIC(:,29) - (ALGEBRAIC(:,30)+ALGEBRAIC(:,76));
ALGEBRAIC(:,74) =  CONSTANTS(:,31).*STATES(:,63) -  CONSTANTS(:,32).*STATES(:,64);
RATES(:,63) = (ALGEBRAIC(:,73)+ALGEBRAIC(:,76)) - ALGEBRAIC(:,74);
ALGEBRAIC(:,68) =  CONSTANTS(:,19).*STATES(:,24).*STATES(:,18) -  CONSTANTS(:,20).*STATES(:,19);
ALGEBRAIC(:,77) =  CONSTANTS(:,34).*STATES(:,24).*STATES(:,65) -  CONSTANTS(:,35).*STATES(:,66);
ALGEBRAIC(:,32) =  CONSTANTS(:,34).*STATES(:,24).*STATES(:,34) -  CONSTANTS(:,35).*STATES(:,35);
ALGEBRAIC(:,47) =  CONSTANTS(:,52).*STATES(:,24).*STATES(:,39) -  CONSTANTS(:,53).*STATES(:,38);
RATES(:,24) = ALGEBRAIC(:,42) - (ALGEBRAIC(:,24)+ALGEBRAIC(:,32)+ALGEBRAIC(:,47)+ALGEBRAIC(:,68)+ALGEBRAIC(:,77));
ALGEBRAIC(:,70) =  CONSTANTS(:,23).*STATES(:,20) -  CONSTANTS(:,24).*STATES(:,69).*STATES(:,19);
ALGEBRAIC(:,80) =  CONSTANTS(:,36).*STATES(:,69).*STATES(:,41) -  CONSTANTS(:,37).*STATES(:,70);
ALGEBRAIC(:,79) =  CONSTANTS(:,23).*STATES(:,67) -  CONSTANTS(:,24).*STATES(:,66).*STATES(:,69);
RATES(:,69) = (ALGEBRAIC(:,70)+ALGEBRAIC(:,79)) - ALGEBRAIC(:,80);
ALGEBRAIC(:,81) =  CONSTANTS(:,38).*STATES(:,70) -  CONSTANTS(:,39).*STATES(:,71).*STATES(:,72);
RATES(:,70) = ALGEBRAIC(:,80) - ALGEBRAIC(:,81);
ALGEBRAIC(:,71) =  CONSTANTS(:,25).*STATES(:,71).*STATES(:,19) -  CONSTANTS(:,26).*STATES(:,21);
ALGEBRAIC(:,82) =  CONSTANTS(:,25).*STATES(:,71).*STATES(:,66) -  CONSTANTS(:,26).*STATES(:,68);
RATES(:,71) = ALGEBRAIC(:,81) - (ALGEBRAIC(:,71)+ALGEBRAIC(:,82));
ALGEBRAIC(:,69) =  CONSTANTS(:,21).*STATES(:,26).*STATES(:,19) -  CONSTANTS(:,22).*STATES(:,20);
ALGEBRAIC(:,72) =  CONSTANTS(:,27).*STATES(:,21) -  CONSTANTS(:,28).*STATES(:,19).*STATES(:,26);
ALGEBRAIC(:,25) =  CONSTANTS(:,21).*STATES(:,26).*STATES(:,25) -  CONSTANTS(:,22).*STATES(:,27);
ALGEBRAIC(:,28) =  CONSTANTS(:,27).*STATES(:,29) -  CONSTANTS(:,28).*STATES(:,25).*STATES(:,26);
ALGEBRAIC(:,33) =  CONSTANTS(:,21).*STATES(:,26).*STATES(:,35) -  CONSTANTS(:,22).*STATES(:,36);
ALGEBRAIC(:,38) =  CONSTANTS(:,27).*STATES(:,37) -  CONSTANTS(:,28).*STATES(:,35).*STATES(:,26);
ALGEBRAIC(:,84) =  CONSTANTS(:,27).*STATES(:,68) -  STATES(:,26).*CONSTANTS(:,28).*STATES(:,66);
ALGEBRAIC(:,78) =  CONSTANTS(:,21).*STATES(:,26).*STATES(:,66) -  CONSTANTS(:,22).*STATES(:,67);
RATES(:,26) = (ALGEBRAIC(:,28)+ALGEBRAIC(:,38)+ALGEBRAIC(:,72)+ALGEBRAIC(:,84)) - (ALGEBRAIC(:,25)+ALGEBRAIC(:,33)+ALGEBRAIC(:,69)+ALGEBRAIC(:,78));
ALGEBRAIC(:,85) =  CONSTANTS(:,58).*STATES(:,73);
RATES(:,41) = (ALGEBRAIC(:,50)+ALGEBRAIC(:,85)) - (ALGEBRAIC(:,35)+ALGEBRAIC(:,80));
ALGEBRAIC(:,83) =  CONSTANTS(:,56).*STATES(:,44).*STATES(:,72) -  CONSTANTS(:,57).*STATES(:,73);
RATES(:,44) = (ALGEBRAIC(:,50)+ALGEBRAIC(:,85)) - (ALGEBRAIC(:,49)+ALGEBRAIC(:,83));
RATES(:,73) = ALGEBRAIC(:,83) - ALGEBRAIC(:,85);
ALGEBRAIC(:,39) =  CONSTANTS(:,40).*STATES(:,35) -  CONSTANTS(:,41).*STATES(:,38).*STATES(:,15);
ALGEBRAIC(:,87) =  CONSTANTS(:,40).*STATES(:,66) -  CONSTANTS(:,41).*STATES(:,17).*STATES(:,38);
ALGEBRAIC(:,40) =  CONSTANTS(:,42).*STATES(:,38) -  CONSTANTS(:,43).*STATES(:,40).*STATES(:,30);
RATES(:,38) = (ALGEBRAIC(:,39)+ALGEBRAIC(:,47)+ALGEBRAIC(:,87)) - ALGEBRAIC(:,40);
ALGEBRAIC(:,86) =  CONSTANTS(:,59).*STATES(:,47).*STATES(:,72) -  CONSTANTS(:,60).*STATES(:,74);
ALGEBRAIC(:,88) =  CONSTANTS(:,61).*STATES(:,74);
RATES(:,74) = ALGEBRAIC(:,86) - ALGEBRAIC(:,88);
ALGEBRAIC(:,44) =  CONSTANTS(:,50).*STATES(:,33) -  CONSTANTS(:,51).*STATES(:,15).*STATES(:,40);
ALGEBRAIC(:,91) =  CONSTANTS(:,50).*STATES(:,64) -  CONSTANTS(:,51).*STATES(:,17).*STATES(:,40);
RATES(:,40) = (ALGEBRAIC(:,40)+ALGEBRAIC(:,44)+ALGEBRAIC(:,91)) - (ALGEBRAIC(:,43)+ALGEBRAIC(:,45));
ALGEBRAIC(:,90) =  CONSTANTS(:,59).*STATES(:,72).*STATES(:,75) -  CONSTANTS(:,60).*STATES(:,76);
ALGEBRAIC(:,92) =  CONSTANTS(:,62).*STATES(:,76);
RATES(:,72) = (ALGEBRAIC(:,81)+ALGEBRAIC(:,88)+ALGEBRAIC(:,92)) - (ALGEBRAIC(:,83)+ALGEBRAIC(:,86)+ALGEBRAIC(:,90));
RATES(:,76) = ALGEBRAIC(:,90) - ALGEBRAIC(:,92);
ALGEBRAIC(:,46) =  CONSTANTS(:,50).*STATES(:,34) -  CONSTANTS(:,51).*STATES(:,15).*STATES(:,39);
ALGEBRAIC(:,93) =  CONSTANTS(:,50).*STATES(:,65) -  CONSTANTS(:,51).*STATES(:,17).*STATES(:,39);
RATES(:,39) = (ALGEBRAIC(:,45)+ALGEBRAIC(:,46)+ALGEBRAIC(:,93)) - ALGEBRAIC(:,47);
ALGEBRAIC(:,41) =  CONSTANTS(:,44).*STATES(:,25) -  CONSTANTS(:,45).*STATES(:,15).*STATES(:,30);
ALGEBRAIC(:,96) =  CONSTANTS(:,9).*STATES(:,15) -  CONSTANTS(:,10).*STATES(:,17);
RATES(:,15) = (ALGEBRAIC(:,13)+ALGEBRAIC(:,39)+ALGEBRAIC(:,41)+ALGEBRAIC(:,44)+ALGEBRAIC(:,46)) - (ALGEBRAIC(:,23)+ALGEBRAIC(:,29)+ALGEBRAIC(:,96));
ALGEBRAIC(:,89) =  CONSTANTS(:,44).*STATES(:,19) -  CONSTANTS(:,45).*STATES(:,17).*STATES(:,30);
RATES(:,17) = (ALGEBRAIC(:,20)+ALGEBRAIC(:,87)+ALGEBRAIC(:,89)+ALGEBRAIC(:,91)+ALGEBRAIC(:,93)+ALGEBRAIC(:,96)) - (ALGEBRAIC(:,67)+ALGEBRAIC(:,73));
ALGEBRAIC(:,48) =  CONSTANTS(:,54).*STATES(:,30).*STATES(:,33) -  CONSTANTS(:,55).*STATES(:,35);
ALGEBRAIC(:,95) =  CONSTANTS(:,54).*STATES(:,30).*STATES(:,64) -  CONSTANTS(:,55).*STATES(:,66);
RATES(:,30) = (ALGEBRAIC(:,40)+ALGEBRAIC(:,41)+ALGEBRAIC(:,89)) - (ALGEBRAIC(:,42)+ALGEBRAIC(:,48)+ALGEBRAIC(:,95));
ALGEBRAIC(:,94) =  CONSTANTS(:,63).*STATES(:,77).*STATES(:,53) -  CONSTANTS(:,64).*STATES(:,78);
ALGEBRAIC(:,97) =  CONSTANTS(:,65).*STATES(:,78);
RATES(:,78) = ALGEBRAIC(:,94) - ALGEBRAIC(:,97);
ALGEBRAIC(:,100) =  CONSTANTS(:,9).*STATES(:,33) -  CONSTANTS(:,10).*STATES(:,64);
RATES(:,33) = ALGEBRAIC(:,30) - (ALGEBRAIC(:,31)+ALGEBRAIC(:,44)+ALGEBRAIC(:,48)+ALGEBRAIC(:,100));
RATES(:,64) = (ALGEBRAIC(:,74)+ALGEBRAIC(:,100)) - (ALGEBRAIC(:,75)+ALGEBRAIC(:,91)+ALGEBRAIC(:,95));
ALGEBRAIC(:,101) =  CONSTANTS(:,66).*STATES(:,53).*STATES(:,75) -  CONSTANTS(:,67).*STATES(:,79);
RATES(:,75) = (ALGEBRAIC(:,88)+ALGEBRAIC(:,97)) - (ALGEBRAIC(:,101)+ALGEBRAIC(:,90));
ALGEBRAIC(:,98) =  CONSTANTS(:,68).*STATES(:,55).*STATES(:,77) -  CONSTANTS(:,69).*STATES(:,80);
ALGEBRAIC(:,102) =  CONSTANTS(:,70).*STATES(:,80);
RATES(:,80) = ALGEBRAIC(:,98) - ALGEBRAIC(:,102);
ALGEBRAIC(:,103) =  CONSTANTS(:,7).*STATES(:,25).*STATES(:,12) -  CONSTANTS(:,8).*STATES(:,88);
ALGEBRAIC(:,99) =  CONSTANTS(:,9).*STATES(:,25) -  CONSTANTS(:,10).*STATES(:,19);
RATES(:,25) = (ALGEBRAIC(:,24)+ALGEBRAIC(:,26)+ALGEBRAIC(:,28)) - (ALGEBRAIC(:,25)+ALGEBRAIC(:,27)+ALGEBRAIC(:,41)+ALGEBRAIC(:,99)+ALGEBRAIC(:,103));
ALGEBRAIC(:,104) =  CONSTANTS(:,65).*STATES(:,79);
RATES(:,47) = (ALGEBRAIC(:,58)+ALGEBRAIC(:,104)) - (ALGEBRAIC(:,51)+ALGEBRAIC(:,86));
RATES(:,53) = (ALGEBRAIC(:,56)+ALGEBRAIC(:,58)+ALGEBRAIC(:,97)+ALGEBRAIC(:,104)) - (ALGEBRAIC(:,55)+ALGEBRAIC(:,57)+ALGEBRAIC(:,94)+ALGEBRAIC(:,101));
RATES(:,79) = ALGEBRAIC(:,101) - ALGEBRAIC(:,104);
ALGEBRAIC(:,105) =  CONSTANTS(:,68).*STATES(:,77).*STATES(:,81) -  CONSTANTS(:,69).*STATES(:,82);
ALGEBRAIC(:,107) =  CONSTANTS(:,71).*STATES(:,82);
RATES(:,77) = (ALGEBRAIC(:,92)+ALGEBRAIC(:,102)+ALGEBRAIC(:,107)) - (ALGEBRAIC(:,94)+ALGEBRAIC(:,98)+ALGEBRAIC(:,105));
RATES(:,82) = ALGEBRAIC(:,105) - ALGEBRAIC(:,107);
ALGEBRAIC(:,108) =  CONSTANTS(:,7).*STATES(:,27).*STATES(:,12) -  CONSTANTS(:,8).*STATES(:,89);
ALGEBRAIC(:,106) =  CONSTANTS(:,9).*STATES(:,27) -  CONSTANTS(:,10).*STATES(:,20);
RATES(:,27) = ALGEBRAIC(:,25) - (ALGEBRAIC(:,26)+ALGEBRAIC(:,106)+ALGEBRAIC(:,108));
ALGEBRAIC(:,109) =  CONSTANTS(:,72).*STATES(:,83).*STATES(:,60) -  CONSTANTS(:,73).*STATES(:,84);
RATES(:,83) = ALGEBRAIC(:,107) - ALGEBRAIC(:,109);
ALGEBRAIC(:,111) =  CONSTANTS(:,74).*STATES(:,84);
RATES(:,84) = ALGEBRAIC(:,109) - ALGEBRAIC(:,111);
ALGEBRAIC(:,112) =  CONSTANTS(:,7).*STATES(:,29).*STATES(:,12) -  CONSTANTS(:,8).*STATES(:,90);
ALGEBRAIC(:,110) =  CONSTANTS(:,9).*STATES(:,29) -  CONSTANTS(:,10).*STATES(:,21);
RATES(:,29) = ALGEBRAIC(:,27) - (ALGEBRAIC(:,28)+ALGEBRAIC(:,110)+ALGEBRAIC(:,112));
ALGEBRAIC(:,113) =  CONSTANTS(:,75).*STATES(:,60).*STATES(:,81) -  CONSTANTS(:,76).*STATES(:,85);
RATES(:,81) = (ALGEBRAIC(:,102)+ALGEBRAIC(:,111)) - (ALGEBRAIC(:,105)+ALGEBRAIC(:,113));
ALGEBRAIC(:,115) =  CONSTANTS(:,77).*STATES(:,85);
RATES(:,55) = (ALGEBRAIC(:,66)+ALGEBRAIC(:,115)) - (ALGEBRAIC(:,59)+ALGEBRAIC(:,98));
RATES(:,60) = (ALGEBRAIC(:,64)+ALGEBRAIC(:,66)+ALGEBRAIC(:,111)+ALGEBRAIC(:,115)) - (ALGEBRAIC(:,63)+ALGEBRAIC(:,65)+ALGEBRAIC(:,109)+ALGEBRAIC(:,113));
RATES(:,85) = ALGEBRAIC(:,113) - ALGEBRAIC(:,115);
ALGEBRAIC(:,116) =  CONSTANTS(:,7).*STATES(:,34).*STATES(:,12) -  CONSTANTS(:,8).*STATES(:,91);
ALGEBRAIC(:,114) =  CONSTANTS(:,9).*STATES(:,34) -  CONSTANTS(:,10).*STATES(:,65);
RATES(:,34) = ALGEBRAIC(:,31) - (ALGEBRAIC(:,32)+ALGEBRAIC(:,46)+ALGEBRAIC(:,114)+ALGEBRAIC(:,116));
ALGEBRAIC(:,118) =  CONSTANTS(:,7).*STATES(:,35).*STATES(:,12) -  CONSTANTS(:,8).*STATES(:,92);
ALGEBRAIC(:,117) =  CONSTANTS(:,9).*STATES(:,35) -  CONSTANTS(:,10).*STATES(:,66);
RATES(:,35) = (ALGEBRAIC(:,32)+ALGEBRAIC(:,34)+ALGEBRAIC(:,38)+ALGEBRAIC(:,48)) - (ALGEBRAIC(:,117)+ALGEBRAIC(:,118)+ALGEBRAIC(:,33)+ALGEBRAIC(:,37)+ALGEBRAIC(:,39));
ALGEBRAIC(:,120) =  CONSTANTS(:,7).*STATES(:,36).*STATES(:,12) -  CONSTANTS(:,8).*STATES(:,93);
ALGEBRAIC(:,119) =  CONSTANTS(:,9).*STATES(:,36) -  CONSTANTS(:,10).*STATES(:,67);
RATES(:,36) = ALGEBRAIC(:,33) - (ALGEBRAIC(:,34)+ALGEBRAIC(:,119)+ALGEBRAIC(:,120));
ALGEBRAIC(:,22) =  CONSTANTS(:,16).*STATES(:,9);
ALGEBRAIC(:,122) =  CONSTANTS(:,7).*STATES(:,37).*STATES(:,12) -  CONSTANTS(:,8).*STATES(:,94);
RATES(:,12) = ALGEBRAIC(:,22) - (ALGEBRAIC(:,10)+ALGEBRAIC(:,103)+ALGEBRAIC(:,108)+ALGEBRAIC(:,112)+ALGEBRAIC(:,116)+ALGEBRAIC(:,118)+ALGEBRAIC(:,120)+ALGEBRAIC(:,122));
ALGEBRAIC(:,121) =  CONSTANTS(:,9).*STATES(:,37) -  CONSTANTS(:,10).*STATES(:,68);
RATES(:,37) = ALGEBRAIC(:,37) - (ALGEBRAIC(:,38)+ALGEBRAIC(:,121)+ALGEBRAIC(:,122));
ALGEBRAIC(:,123) = ( CONSTANTS(:,80).*1.00000)./(CONSTANTS(:,2)./( CONSTANTS(:,1).*STATES(:,1))+1.00000);
ALGEBRAIC(:,124) = piecewise({ALGEBRAIC(:,123)<3100.00, 1.55000 , ALGEBRAIC(:,123)>100000., 0.200000 }, ( ALGEBRAIC(:,123).* - 1.35000e-05+1.55000)./1.00000);
ALGEBRAIC(:,125) =  ALGEBRAIC(:,124).*STATES(:,7);
RATES(:,7) = ALGEBRAIC(:,10) - ALGEBRAIC(:,125);
RATES(:,18) = (ALGEBRAIC(:,125)+ALGEBRAIC(:,14)+ALGEBRAIC(:,67)) - ALGEBRAIC(:,68);
ALGEBRAIC(:,126) =  ALGEBRAIC(:,124).*STATES(:,88);
RATES(:,19) = (ALGEBRAIC(:,70)+ALGEBRAIC(:,68)+ALGEBRAIC(:,72)+ALGEBRAIC(:,99)+ALGEBRAIC(:,126)) - (ALGEBRAIC(:,69)+ALGEBRAIC(:,71)+ALGEBRAIC(:,89));
RATES(:,88) = ALGEBRAIC(:,103) - ALGEBRAIC(:,126);
ALGEBRAIC(:,127) =  ALGEBRAIC(:,124).*STATES(:,89);
RATES(:,20) = (ALGEBRAIC(:,69)+ALGEBRAIC(:,106)+ALGEBRAIC(:,127)) - ALGEBRAIC(:,70);
RATES(:,89) = ALGEBRAIC(:,108) - ALGEBRAIC(:,127);
ALGEBRAIC(:,128) =  ALGEBRAIC(:,124).*STATES(:,90);
RATES(:,21) = (ALGEBRAIC(:,71)+ALGEBRAIC(:,110)+ALGEBRAIC(:,128)) - ALGEBRAIC(:,72);
RATES(:,90) = ALGEBRAIC(:,112) - ALGEBRAIC(:,128);
ALGEBRAIC(:,129) =  ALGEBRAIC(:,124).*STATES(:,91);
RATES(:,65) = (ALGEBRAIC(:,75)+ALGEBRAIC(:,114)+ALGEBRAIC(:,129)) - (ALGEBRAIC(:,77)+ALGEBRAIC(:,93));
RATES(:,91) = ALGEBRAIC(:,116) - ALGEBRAIC(:,129);
ALGEBRAIC(:,130) =  ALGEBRAIC(:,124).*STATES(:,92);
RATES(:,66) = (ALGEBRAIC(:,77)+ALGEBRAIC(:,79)+ALGEBRAIC(:,84)+ALGEBRAIC(:,95)+ALGEBRAIC(:,117)+ALGEBRAIC(:,130)) - (ALGEBRAIC(:,78)+ALGEBRAIC(:,82)+ALGEBRAIC(:,87));
RATES(:,92) = ALGEBRAIC(:,118) - ALGEBRAIC(:,130);
ALGEBRAIC(:,131) =  ALGEBRAIC(:,124).*STATES(:,93);
RATES(:,67) = (ALGEBRAIC(:,78)+ALGEBRAIC(:,119)+ALGEBRAIC(:,131)) - ALGEBRAIC(:,79);
RATES(:,93) = ALGEBRAIC(:,120) - ALGEBRAIC(:,131);
ALGEBRAIC(:,132) =  ALGEBRAIC(:,124).*STATES(:,94);
RATES(:,9) = (ALGEBRAIC(:,125)+ALGEBRAIC(:,126)+ALGEBRAIC(:,127)+ALGEBRAIC(:,128)+ALGEBRAIC(:,129)+ALGEBRAIC(:,130)+ALGEBRAIC(:,131)+ALGEBRAIC(:,132)) - ALGEBRAIC(:,22);
RATES(:,68) = (ALGEBRAIC(:,82)+ALGEBRAIC(:,121)+ALGEBRAIC(:,132)) - ALGEBRAIC(:,84);
RATES(:,94) = ALGEBRAIC(:,122) - ALGEBRAIC(:,132);
RATES = RATES';
end

% Calculate algebraic variables
function ALGEBRAIC = computeAlgebraic(ALGEBRAIC, CONSTANTS, STATES, VOI)
statesSize = size(STATES);
statesColumnCount = statesSize(2);
if ( statesColumnCount == 1)
STATES = STATES';
utilOnes = 1;
else
statesRowCount = statesSize(1);
utilOnes = ones(statesRowCount, 1);
end
ALGEBRAIC(:,1) =  CONSTANTS(:,1).*STATES(:,1).*STATES(:,2) -  CONSTANTS(:,2).*STATES(:,3);
ALGEBRAIC(:,8) =  CONSTANTS(:,3).*STATES(:,3).*STATES(:,3) -  CONSTANTS(:,4).*STATES(:,4);
ALGEBRAIC(:,9) =  CONSTANTS(:,5).*STATES(:,4) -  CONSTANTS(:,6).*STATES(:,5);
ALGEBRAIC(:,11) =  CONSTANTS(:,9).*STATES(:,2) -  CONSTANTS(:,10).*STATES(:,6);
ALGEBRAIC(:,12) =  CONSTANTS(:,9).*STATES(:,5);
ALGEBRAIC(:,13) =  CONSTANTS(:,11).*STATES(:,5).*STATES(:,14) -  CONSTANTS(:,12).*STATES(:,15);
ALGEBRAIC(:,15) =  CONSTANTS(:,13).*STATES(:,6).*STATES(:,16) -  CONSTANTS(:,14).*STATES(:,10);
ALGEBRAIC(:,16) =  CONSTANTS(:,78).*STATES(:,6);
ALGEBRAIC(:,17) =  CONSTANTS(:,3).*STATES(:,10).*STATES(:,10) -  CONSTANTS(:,4).*STATES(:,11);
ALGEBRAIC(:,18) =  CONSTANTS(:,79).*STATES(:,16);
ALGEBRAIC(:,19) =  CONSTANTS(:,5).*STATES(:,11) -  CONSTANTS(:,6).*STATES(:,8);
ALGEBRAIC(:,20) =  CONSTANTS(:,11).*STATES(:,8).*STATES(:,14) -  CONSTANTS(:,12).*STATES(:,17);
ALGEBRAIC(:,21) =  CONSTANTS(:,78).*STATES(:,8);
ALGEBRAIC(:,10) =  CONSTANTS(:,7).*STATES(:,23).*STATES(:,12) -  CONSTANTS(:,8).*STATES(:,7);
ALGEBRAIC(:,23) =  CONSTANTS(:,17).*STATES(:,22).*STATES(:,15) -  CONSTANTS(:,18).*STATES(:,23);
ALGEBRAIC(:,14) =  CONSTANTS(:,9).*STATES(:,23);
ALGEBRAIC(:,24) =  CONSTANTS(:,19).*STATES(:,24).*STATES(:,23) -  CONSTANTS(:,20).*STATES(:,25);
ALGEBRAIC(:,26) =  CONSTANTS(:,23).*STATES(:,27) -  CONSTANTS(:,24).*STATES(:,28).*STATES(:,25);
ALGEBRAIC(:,34) =  CONSTANTS(:,23).*STATES(:,36) -  CONSTANTS(:,24).*STATES(:,35).*STATES(:,28);
ALGEBRAIC(:,35) =  CONSTANTS(:,36).*STATES(:,28).*STATES(:,41) -  CONSTANTS(:,37).*STATES(:,42);
ALGEBRAIC(:,36) =  CONSTANTS(:,38).*STATES(:,42) -  CONSTANTS(:,39).*STATES(:,43).*STATES(:,45);
ALGEBRAIC(:,27) =  CONSTANTS(:,25).*STATES(:,25).*STATES(:,43) -  CONSTANTS(:,26).*STATES(:,29);
ALGEBRAIC(:,37) =  CONSTANTS(:,25).*STATES(:,35).*STATES(:,43) -  CONSTANTS(:,26).*STATES(:,37);
ALGEBRAIC(:,50) =  CONSTANTS(:,58).*STATES(:,46);
ALGEBRAIC(:,49) =  CONSTANTS(:,56).*STATES(:,44).*STATES(:,45) -  CONSTANTS(:,57).*STATES(:,46);
ALGEBRAIC(:,51) =  CONSTANTS(:,59).*STATES(:,47).*STATES(:,45) -  CONSTANTS(:,60).*STATES(:,48);
ALGEBRAIC(:,52) =  CONSTANTS(:,61).*STATES(:,48);
ALGEBRAIC(:,53) =  CONSTANTS(:,59).*STATES(:,49).*STATES(:,45) -  CONSTANTS(:,60).*STATES(:,50);
ALGEBRAIC(:,54) =  CONSTANTS(:,62).*STATES(:,50);
ALGEBRAIC(:,56) =  CONSTANTS(:,65).*STATES(:,52);
ALGEBRAIC(:,55) =  CONSTANTS(:,63).*STATES(:,51).*STATES(:,53) -  CONSTANTS(:,64).*STATES(:,52);
ALGEBRAIC(:,57) =  CONSTANTS(:,66).*STATES(:,53).*STATES(:,49) -  CONSTANTS(:,67).*STATES(:,54);
ALGEBRAIC(:,58) =  CONSTANTS(:,65).*STATES(:,54);
ALGEBRAIC(:,59) =  CONSTANTS(:,68).*STATES(:,55).*STATES(:,51) -  CONSTANTS(:,69).*STATES(:,56);
ALGEBRAIC(:,60) =  CONSTANTS(:,70).*STATES(:,56);
ALGEBRAIC(:,61) =  CONSTANTS(:,68).*STATES(:,51).*STATES(:,57) -  CONSTANTS(:,69).*STATES(:,58);
ALGEBRAIC(:,62) =  CONSTANTS(:,71).*STATES(:,58);
ALGEBRAIC(:,63) =  CONSTANTS(:,72).*STATES(:,59).*STATES(:,60) -  CONSTANTS(:,73).*STATES(:,61);
ALGEBRAIC(:,64) =  CONSTANTS(:,74).*STATES(:,61);
ALGEBRAIC(:,65) =  CONSTANTS(:,75).*STATES(:,60).*STATES(:,57) -  CONSTANTS(:,76).*STATES(:,62);
ALGEBRAIC(:,66) =  CONSTANTS(:,77).*STATES(:,62);
ALGEBRAIC(:,29) =  CONSTANTS(:,29).*STATES(:,31).*STATES(:,15) -  CONSTANTS(:,30).*STATES(:,32);
ALGEBRAIC(:,73) =  CONSTANTS(:,29).*STATES(:,31).*STATES(:,17) -  CONSTANTS(:,30).*STATES(:,63);
ALGEBRAIC(:,43) = ( CONSTANTS(:,49).*STATES(:,40))./(CONSTANTS(:,48)+STATES(:,40));
ALGEBRAIC(:,67) =  CONSTANTS(:,17).*STATES(:,17).*STATES(:,22) -  CONSTANTS(:,18).*STATES(:,18);
ALGEBRAIC(:,31) =  CONSTANTS(:,17).*STATES(:,22).*STATES(:,33) -  CONSTANTS(:,33).*STATES(:,34);
ALGEBRAIC(:,42) =  CONSTANTS(:,46).*STATES(:,30) -  CONSTANTS(:,47).*STATES(:,24).*STATES(:,22);
ALGEBRAIC(:,45) =  CONSTANTS(:,17).*STATES(:,22).*STATES(:,40) -  CONSTANTS(:,33).*STATES(:,39);
ALGEBRAIC(:,75) =  CONSTANTS(:,17).*STATES(:,22).*STATES(:,64) -  CONSTANTS(:,33).*STATES(:,65);
ALGEBRAIC(:,30) =  CONSTANTS(:,31).*STATES(:,32) -  CONSTANTS(:,32).*STATES(:,33);
ALGEBRAIC(:,76) =  CONSTANTS(:,9).*STATES(:,32) -  CONSTANTS(:,10).*STATES(:,63);
ALGEBRAIC(:,74) =  CONSTANTS(:,31).*STATES(:,63) -  CONSTANTS(:,32).*STATES(:,64);
ALGEBRAIC(:,68) =  CONSTANTS(:,19).*STATES(:,24).*STATES(:,18) -  CONSTANTS(:,20).*STATES(:,19);
ALGEBRAIC(:,77) =  CONSTANTS(:,34).*STATES(:,24).*STATES(:,65) -  CONSTANTS(:,35).*STATES(:,66);
ALGEBRAIC(:,32) =  CONSTANTS(:,34).*STATES(:,24).*STATES(:,34) -  CONSTANTS(:,35).*STATES(:,35);
ALGEBRAIC(:,47) =  CONSTANTS(:,52).*STATES(:,24).*STATES(:,39) -  CONSTANTS(:,53).*STATES(:,38);
ALGEBRAIC(:,70) =  CONSTANTS(:,23).*STATES(:,20) -  CONSTANTS(:,24).*STATES(:,69).*STATES(:,19);
ALGEBRAIC(:,80) =  CONSTANTS(:,36).*STATES(:,69).*STATES(:,41) -  CONSTANTS(:,37).*STATES(:,70);
ALGEBRAIC(:,79) =  CONSTANTS(:,23).*STATES(:,67) -  CONSTANTS(:,24).*STATES(:,66).*STATES(:,69);
ALGEBRAIC(:,81) =  CONSTANTS(:,38).*STATES(:,70) -  CONSTANTS(:,39).*STATES(:,71).*STATES(:,72);
ALGEBRAIC(:,71) =  CONSTANTS(:,25).*STATES(:,71).*STATES(:,19) -  CONSTANTS(:,26).*STATES(:,21);
ALGEBRAIC(:,82) =  CONSTANTS(:,25).*STATES(:,71).*STATES(:,66) -  CONSTANTS(:,26).*STATES(:,68);
ALGEBRAIC(:,69) =  CONSTANTS(:,21).*STATES(:,26).*STATES(:,19) -  CONSTANTS(:,22).*STATES(:,20);
ALGEBRAIC(:,72) =  CONSTANTS(:,27).*STATES(:,21) -  CONSTANTS(:,28).*STATES(:,19).*STATES(:,26);
ALGEBRAIC(:,25) =  CONSTANTS(:,21).*STATES(:,26).*STATES(:,25) -  CONSTANTS(:,22).*STATES(:,27);
ALGEBRAIC(:,28) =  CONSTANTS(:,27).*STATES(:,29) -  CONSTANTS(:,28).*STATES(:,25).*STATES(:,26);
ALGEBRAIC(:,33) =  CONSTANTS(:,21).*STATES(:,26).*STATES(:,35) -  CONSTANTS(:,22).*STATES(:,36);
ALGEBRAIC(:,38) =  CONSTANTS(:,27).*STATES(:,37) -  CONSTANTS(:,28).*STATES(:,35).*STATES(:,26);
ALGEBRAIC(:,84) =  CONSTANTS(:,27).*STATES(:,68) -  STATES(:,26).*CONSTANTS(:,28).*STATES(:,66);
ALGEBRAIC(:,78) =  CONSTANTS(:,21).*STATES(:,26).*STATES(:,66) -  CONSTANTS(:,22).*STATES(:,67);
ALGEBRAIC(:,85) =  CONSTANTS(:,58).*STATES(:,73);
ALGEBRAIC(:,83) =  CONSTANTS(:,56).*STATES(:,44).*STATES(:,72) -  CONSTANTS(:,57).*STATES(:,73);
ALGEBRAIC(:,39) =  CONSTANTS(:,40).*STATES(:,35) -  CONSTANTS(:,41).*STATES(:,38).*STATES(:,15);
ALGEBRAIC(:,87) =  CONSTANTS(:,40).*STATES(:,66) -  CONSTANTS(:,41).*STATES(:,17).*STATES(:,38);
ALGEBRAIC(:,40) =  CONSTANTS(:,42).*STATES(:,38) -  CONSTANTS(:,43).*STATES(:,40).*STATES(:,30);
ALGEBRAIC(:,86) =  CONSTANTS(:,59).*STATES(:,47).*STATES(:,72) -  CONSTANTS(:,60).*STATES(:,74);
ALGEBRAIC(:,88) =  CONSTANTS(:,61).*STATES(:,74);
ALGEBRAIC(:,44) =  CONSTANTS(:,50).*STATES(:,33) -  CONSTANTS(:,51).*STATES(:,15).*STATES(:,40);
ALGEBRAIC(:,91) =  CONSTANTS(:,50).*STATES(:,64) -  CONSTANTS(:,51).*STATES(:,17).*STATES(:,40);
ALGEBRAIC(:,90) =  CONSTANTS(:,59).*STATES(:,72).*STATES(:,75) -  CONSTANTS(:,60).*STATES(:,76);
ALGEBRAIC(:,92) =  CONSTANTS(:,62).*STATES(:,76);
ALGEBRAIC(:,46) =  CONSTANTS(:,50).*STATES(:,34) -  CONSTANTS(:,51).*STATES(:,15).*STATES(:,39);
ALGEBRAIC(:,93) =  CONSTANTS(:,50).*STATES(:,65) -  CONSTANTS(:,51).*STATES(:,17).*STATES(:,39);
ALGEBRAIC(:,41) =  CONSTANTS(:,44).*STATES(:,25) -  CONSTANTS(:,45).*STATES(:,15).*STATES(:,30);
ALGEBRAIC(:,96) =  CONSTANTS(:,9).*STATES(:,15) -  CONSTANTS(:,10).*STATES(:,17);
ALGEBRAIC(:,89) =  CONSTANTS(:,44).*STATES(:,19) -  CONSTANTS(:,45).*STATES(:,17).*STATES(:,30);
ALGEBRAIC(:,48) =  CONSTANTS(:,54).*STATES(:,30).*STATES(:,33) -  CONSTANTS(:,55).*STATES(:,35);
ALGEBRAIC(:,95) =  CONSTANTS(:,54).*STATES(:,30).*STATES(:,64) -  CONSTANTS(:,55).*STATES(:,66);
ALGEBRAIC(:,94) =  CONSTANTS(:,63).*STATES(:,77).*STATES(:,53) -  CONSTANTS(:,64).*STATES(:,78);
ALGEBRAIC(:,97) =  CONSTANTS(:,65).*STATES(:,78);
ALGEBRAIC(:,100) =  CONSTANTS(:,9).*STATES(:,33) -  CONSTANTS(:,10).*STATES(:,64);
ALGEBRAIC(:,101) =  CONSTANTS(:,66).*STATES(:,53).*STATES(:,75) -  CONSTANTS(:,67).*STATES(:,79);
ALGEBRAIC(:,98) =  CONSTANTS(:,68).*STATES(:,55).*STATES(:,77) -  CONSTANTS(:,69).*STATES(:,80);
ALGEBRAIC(:,102) =  CONSTANTS(:,70).*STATES(:,80);
ALGEBRAIC(:,103) =  CONSTANTS(:,7).*STATES(:,25).*STATES(:,12) -  CONSTANTS(:,8).*STATES(:,88);
ALGEBRAIC(:,99) =  CONSTANTS(:,9).*STATES(:,25) -  CONSTANTS(:,10).*STATES(:,19);
ALGEBRAIC(:,104) =  CONSTANTS(:,65).*STATES(:,79);
ALGEBRAIC(:,105) =  CONSTANTS(:,68).*STATES(:,77).*STATES(:,81) -  CONSTANTS(:,69).*STATES(:,82);
ALGEBRAIC(:,107) =  CONSTANTS(:,71).*STATES(:,82);
ALGEBRAIC(:,108) =  CONSTANTS(:,7).*STATES(:,27).*STATES(:,12) -  CONSTANTS(:,8).*STATES(:,89);
ALGEBRAIC(:,106) =  CONSTANTS(:,9).*STATES(:,27) -  CONSTANTS(:,10).*STATES(:,20);
ALGEBRAIC(:,109) =  CONSTANTS(:,72).*STATES(:,83).*STATES(:,60) -  CONSTANTS(:,73).*STATES(:,84);
ALGEBRAIC(:,111) =  CONSTANTS(:,74).*STATES(:,84);
ALGEBRAIC(:,112) =  CONSTANTS(:,7).*STATES(:,29).*STATES(:,12) -  CONSTANTS(:,8).*STATES(:,90);
ALGEBRAIC(:,110) =  CONSTANTS(:,9).*STATES(:,29) -  CONSTANTS(:,10).*STATES(:,21);
ALGEBRAIC(:,113) =  CONSTANTS(:,75).*STATES(:,60).*STATES(:,81) -  CONSTANTS(:,76).*STATES(:,85);
ALGEBRAIC(:,115) =  CONSTANTS(:,77).*STATES(:,85);
ALGEBRAIC(:,116) =  CONSTANTS(:,7).*STATES(:,34).*STATES(:,12) -  CONSTANTS(:,8).*STATES(:,91);
ALGEBRAIC(:,114) =  CONSTANTS(:,9).*STATES(:,34) -  CONSTANTS(:,10).*STATES(:,65);
ALGEBRAIC(:,118) =  CONSTANTS(:,7).*STATES(:,35).*STATES(:,12) -  CONSTANTS(:,8).*STATES(:,92);
ALGEBRAIC(:,117) =  CONSTANTS(:,9).*STATES(:,35) -  CONSTANTS(:,10).*STATES(:,66);
ALGEBRAIC(:,120) =  CONSTANTS(:,7).*STATES(:,36).*STATES(:,12) -  CONSTANTS(:,8).*STATES(:,93);
ALGEBRAIC(:,119) =  CONSTANTS(:,9).*STATES(:,36) -  CONSTANTS(:,10).*STATES(:,67);
ALGEBRAIC(:,22) =  CONSTANTS(:,16).*STATES(:,9);
ALGEBRAIC(:,122) =  CONSTANTS(:,7).*STATES(:,37).*STATES(:,12) -  CONSTANTS(:,8).*STATES(:,94);
ALGEBRAIC(:,121) =  CONSTANTS(:,9).*STATES(:,37) -  CONSTANTS(:,10).*STATES(:,68);
ALGEBRAIC(:,123) = ( CONSTANTS(:,80).*1.00000)./(CONSTANTS(:,2)./( CONSTANTS(:,1).*STATES(:,1))+1.00000);
ALGEBRAIC(:,124) = piecewise({ALGEBRAIC(:,123)<3100.00, 1.55000 , ALGEBRAIC(:,123)>100000., 0.200000 }, ( ALGEBRAIC(:,123).* - 1.35000e-05+1.55000)./1.00000);
ALGEBRAIC(:,125) =  ALGEBRAIC(:,124).*STATES(:,7);
ALGEBRAIC(:,126) =  ALGEBRAIC(:,124).*STATES(:,88);
ALGEBRAIC(:,127) =  ALGEBRAIC(:,124).*STATES(:,89);
ALGEBRAIC(:,128) =  ALGEBRAIC(:,124).*STATES(:,90);
ALGEBRAIC(:,129) =  ALGEBRAIC(:,124).*STATES(:,91);
ALGEBRAIC(:,130) =  ALGEBRAIC(:,124).*STATES(:,92);
ALGEBRAIC(:,131) =  ALGEBRAIC(:,124).*STATES(:,93);
ALGEBRAIC(:,132) =  ALGEBRAIC(:,124).*STATES(:,94);
ALGEBRAIC(:,2) = STATES(:,45)+STATES(:,46)+STATES(:,48)+STATES(:,50)+STATES(:,72)+STATES(:,73)+STATES(:,74)+STATES(:,76);
ALGEBRAIC(:,3) = STATES(:,51)+STATES(:,77);
ALGEBRAIC(:,4) = STATES(:,59)+STATES(:,83);
ALGEBRAIC(:,5) = STATES(:,42)+STATES(:,28)+STATES(:,70)+STATES(:,69);
ALGEBRAIC(:,6) = STATES(:,33)+STATES(:,34)+STATES(:,35)+STATES(:,36)+STATES(:,37)+STATES(:,38)+STATES(:,39)+STATES(:,40)+STATES(:,64)+STATES(:,65)+STATES(:,66)+STATES(:,67)+STATES(:,68)+STATES(:,91)+STATES(:,92)+STATES(:,93)+STATES(:,94);
ALGEBRAIC(:,7) =  2.00000.*(STATES(:,5)+STATES(:,7)+STATES(:,8)+STATES(:,11)+STATES(:,15)+STATES(:,17)+STATES(:,18)+STATES(:,19)+STATES(:,20)+STATES(:,21)+STATES(:,23)+STATES(:,25)+STATES(:,27)+STATES(:,29)+STATES(:,32)+STATES(:,33)+STATES(:,34)+STATES(:,35)+STATES(:,36)+STATES(:,37)+STATES(:,63)+STATES(:,64)+STATES(:,65)+STATES(:,66)+STATES(:,67)+STATES(:,68)+STATES(:,88)+STATES(:,89)+STATES(:,90)+STATES(:,91)+STATES(:,92)+STATES(:,93)+STATES(:,94));
end

% Compute result of a piecewise function
function x = piecewise(cases, default)
set = [0];
for i = 1:2:length(cases)
if (length(cases{i+1}) == 1)
x(cases{i} & ~set,:) = cases{i+1};
else
x(cases{i} & ~set,:) = cases{i+1}(cases{i} & ~set);
end
set = set | cases{i};
if(set), break, end
end
if (length(default) == 1)
x(~set,:) = default;
else
x(~set,:) = default(~set);
end
end

% Pad out or shorten strings to a set length
function strout = strpad(strin)
req_length = 160;
insize = size(strin,2);
if insize > req_length
strout = strin(1:req_length);
else
strout = [strin, blanks(req_length - insize)];
end
end

```
Source
Derived from workspace Schoeberl, Eichler-Jonsson, Gilles, Muller, 2002 at changeset 8b48eacb54d2.
Collaboration
To begin collaborating on this work, please use your git client and issue this command:
Downloads
Tools
License

This work is licensed under a Creative Commons Attribution 3.0 Unported License.