# 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 =198;
end
% There are a total of 41 entries in each of the rate and state variable arrays.
% There are a total of 139 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 (millisecond)');
LEGEND_CONSTANTS(:,1) = strpad('celltype in component environment (dimensionless)');
LEGEND_CONSTANTS(:,2) = strpad('nao in component extracellular (millimolar)');
LEGEND_CONSTANTS(:,3) = strpad('cao in component extracellular (millimolar)');
LEGEND_CONSTANTS(:,4) = strpad('ko in component extracellular (millimolar)');
LEGEND_CONSTANTS(:,5) = strpad('R in component physical_constants (joule_per_kilomole_kelvin)');
LEGEND_CONSTANTS(:,6) = strpad('T in component physical_constants (kelvin)');
LEGEND_CONSTANTS(:,7) = strpad('F in component physical_constants (coulomb_per_mole)');
LEGEND_CONSTANTS(:,8) = strpad('zna in component physical_constants (dimensionless)');
LEGEND_CONSTANTS(:,9) = strpad('zca in component physical_constants (dimensionless)');
LEGEND_CONSTANTS(:,10) = strpad('zk in component physical_constants (dimensionless)');
LEGEND_CONSTANTS(:,11) = strpad('L in component cell_geometry (centimeter)');
LEGEND_CONSTANTS(:,105) = strpad('vcell in component cell_geometry (microliter)');
LEGEND_CONSTANTS(:,114) = strpad('Ageo in component cell_geometry (centimeter_squared)');
LEGEND_CONSTANTS(:,118) = strpad('Acap in component cell_geometry (centimeter_squared)');
LEGEND_CONSTANTS(:,119) = strpad('vmyo in component cell_geometry (microliter)');
LEGEND_CONSTANTS(:,120) = strpad('vnsr in component cell_geometry (microliter)');
LEGEND_CONSTANTS(:,121) = strpad('vjsr in component cell_geometry (microliter)');
LEGEND_CONSTANTS(:,122) = strpad('vss in component cell_geometry (microliter)');
LEGEND_STATES(:,1) = strpad('v in component membrane (millivolt)');
LEGEND_ALGEBRAIC(:,30) = strpad('vffrt in component membrane (coulomb_per_mole)');
LEGEND_ALGEBRAIC(:,40) = strpad('vfrt in component membrane (dimensionless)');
LEGEND_ALGEBRAIC(:,63) = strpad('INa in component INa (microA_per_microF)');
LEGEND_ALGEBRAIC(:,65) = strpad('INaL in component INaL (microA_per_microF)');
LEGEND_ALGEBRAIC(:,71) = strpad('Ito in component Ito (microA_per_microF)');
LEGEND_ALGEBRAIC(:,82) = strpad('ICaL in component ICaL (microA_per_microF)');
LEGEND_ALGEBRAIC(:,83) = strpad('ICaNa in component ICaL (microA_per_microF)');
LEGEND_ALGEBRAIC(:,86) = strpad('ICaK in component ICaL (microA_per_microF)');
LEGEND_ALGEBRAIC(:,97) = strpad('IKr in component IKr (microA_per_microF)');
LEGEND_ALGEBRAIC(:,99) = strpad('IKs in component IKs (microA_per_microF)');
LEGEND_ALGEBRAIC(:,101) = strpad('IK1 in component IK1 (microA_per_microF)');
LEGEND_ALGEBRAIC(:,133) = strpad('INaCa_i in component INaCa_i (microA_per_microF)');
LEGEND_ALGEBRAIC(:,163) = strpad('INaCa_ss in component INaCa_i (microA_per_microF)');
LEGEND_ALGEBRAIC(:,182) = strpad('INaK in component INaK (microA_per_microF)');
LEGEND_ALGEBRAIC(:,185) = strpad('INab in component INab (microA_per_microF)');
LEGEND_ALGEBRAIC(:,184) = strpad('IKb in component IKb (microA_per_microF)');
LEGEND_ALGEBRAIC(:,189) = strpad('IpCa in component IpCa (microA_per_microF)');
LEGEND_ALGEBRAIC(:,187) = strpad('ICab in component ICab (microA_per_microF)');
LEGEND_ALGEBRAIC(:,13) = strpad('Istim in component membrane (microA_per_microF)');
LEGEND_CONSTANTS(:,13) = strpad('amp in component membrane (microA_per_microF)');
LEGEND_CONSTANTS(:,14) = strpad('duration in component membrane (millisecond)');
LEGEND_CONSTANTS(:,15) = strpad('KmCaMK in component CaMK (millimolar)');
LEGEND_CONSTANTS(:,16) = strpad('aCaMK in component CaMK (per_millimolar_per_millisecond)');
LEGEND_CONSTANTS(:,17) = strpad('bCaMK in component CaMK (per_millisecond)');
LEGEND_CONSTANTS(:,18) = strpad('CaMKo in component CaMK (dimensionless)');
LEGEND_CONSTANTS(:,19) = strpad('KmCaM in component CaMK (millimolar)');
LEGEND_ALGEBRAIC(:,46) = strpad('CaMKb in component CaMK (millimolar)');
LEGEND_ALGEBRAIC(:,48) = strpad('CaMKa in component CaMK (millimolar)');
LEGEND_STATES(:,2) = strpad('CaMKt in component CaMK (millimolar)');
LEGEND_STATES(:,3) = strpad('cass in component intracellular_ions (millimolar)');
LEGEND_CONSTANTS(:,20) = strpad('cmdnmax_b in component intracellular_ions (millimolar)');
LEGEND_CONSTANTS(:,94) = strpad('cmdnmax in component intracellular_ions (millimolar)');
LEGEND_CONSTANTS(:,21) = strpad('kmcmdn in component intracellular_ions (millimolar)');
LEGEND_CONSTANTS(:,22) = strpad('trpnmax in component intracellular_ions (millimolar)');
LEGEND_CONSTANTS(:,23) = strpad('kmtrpn in component intracellular_ions (millimolar)');
LEGEND_CONSTANTS(:,24) = strpad('BSRmax in component intracellular_ions (millimolar)');
LEGEND_CONSTANTS(:,25) = strpad('KmBSR in component intracellular_ions (millimolar)');
LEGEND_CONSTANTS(:,26) = strpad('BSLmax in component intracellular_ions (millimolar)');
LEGEND_CONSTANTS(:,27) = strpad('KmBSL in component intracellular_ions (millimolar)');
LEGEND_CONSTANTS(:,28) = strpad('csqnmax in component intracellular_ions (millimolar)');
LEGEND_CONSTANTS(:,29) = strpad('kmcsqn in component intracellular_ions (millimolar)');
LEGEND_STATES(:,4) = strpad('nai in component intracellular_ions (millimolar)');
LEGEND_STATES(:,5) = strpad('nass in component intracellular_ions (millimolar)');
LEGEND_STATES(:,6) = strpad('ki in component intracellular_ions (millimolar)');
LEGEND_STATES(:,7) = strpad('kss in component intracellular_ions (millimolar)');
LEGEND_STATES(:,8) = strpad('cansr in component intracellular_ions (millimolar)');
LEGEND_STATES(:,9) = strpad('cajsr in component intracellular_ions (millimolar)');
LEGEND_STATES(:,10) = strpad('cai in component intracellular_ions (millimolar)');
LEGEND_ALGEBRAIC(:,188) = strpad('JdiffNa in component diff (millimolar_per_millisecond)');
LEGEND_ALGEBRAIC(:,190) = strpad('Jdiff in component diff (millimolar_per_millisecond)');
LEGEND_ALGEBRAIC(:,197) = strpad('Jup in component SERCA (millimolar_per_millisecond)');
LEGEND_ALGEBRAIC(:,186) = strpad('JdiffK in component diff (millimolar_per_millisecond)');
LEGEND_ALGEBRAIC(:,192) = strpad('Jrel in component ryr (millimolar_per_millisecond)');
LEGEND_ALGEBRAIC(:,198) = strpad('Jtr in component trans_flux (millimolar_per_millisecond)');
LEGEND_ALGEBRAIC(:,50) = strpad('Bcai in component intracellular_ions (dimensionless)');
LEGEND_ALGEBRAIC(:,54) = strpad('Bcajsr in component intracellular_ions (dimensionless)');
LEGEND_ALGEBRAIC(:,52) = strpad('Bcass in component intracellular_ions (dimensionless)');
LEGEND_CONSTANTS(:,30) = strpad('cm in component intracellular_ions (microF_per_centimeter_squared)');
LEGEND_CONSTANTS(:,31) = strpad('PKNa in component reversal_potentials (dimensionless)');
LEGEND_ALGEBRAIC(:,57) = strpad('ENa in component reversal_potentials (millivolt)');
LEGEND_ALGEBRAIC(:,58) = strpad('EK in component reversal_potentials (millivolt)');
LEGEND_ALGEBRAIC(:,59) = strpad('EKs in component reversal_potentials (millivolt)');
LEGEND_ALGEBRAIC(:,1) = strpad('mss in component INa (dimensionless)');
LEGEND_ALGEBRAIC(:,14) = strpad('tm in component INa (millisecond)');
LEGEND_CONSTANTS(:,32) = strpad('mssV1 in component INa (millivolt)');
LEGEND_CONSTANTS(:,33) = strpad('mssV2 in component INa (millivolt)');
LEGEND_CONSTANTS(:,34) = strpad('mtV1 in component INa (millivolt)');
LEGEND_CONSTANTS(:,35) = strpad('mtV2 in component INa (millivolt)');
LEGEND_CONSTANTS(:,36) = strpad('mtD1 in component INa (dimensionless)');
LEGEND_CONSTANTS(:,37) = strpad('mtD2 in component INa (dimensionless)');
LEGEND_CONSTANTS(:,38) = strpad('mtV3 in component INa (millivolt)');
LEGEND_CONSTANTS(:,39) = strpad('mtV4 in component INa (millivolt)');
LEGEND_STATES(:,11) = strpad('m in component INa (dimensionless)');
LEGEND_ALGEBRAIC(:,2) = strpad('hss in component INa (dimensionless)');
LEGEND_ALGEBRAIC(:,15) = strpad('thf in component INa (millisecond)');
LEGEND_ALGEBRAIC(:,16) = strpad('ths in component INa (millisecond)');
LEGEND_CONSTANTS(:,40) = strpad('hssV1 in component INa (millivolt)');
LEGEND_CONSTANTS(:,41) = strpad('hssV2 in component INa (millivolt)');
LEGEND_CONSTANTS(:,95) = strpad('Ahs in component INa (dimensionless)');
LEGEND_CONSTANTS(:,42) = strpad('Ahf in component INa (dimensionless)');
LEGEND_STATES(:,12) = strpad('hf in component INa (dimensionless)');
LEGEND_STATES(:,13) = strpad('hs in component INa (dimensionless)');
LEGEND_ALGEBRAIC(:,60) = strpad('h in component INa (dimensionless)');
LEGEND_CONSTANTS(:,43) = strpad('GNa in component INa (milliS_per_microF)');
LEGEND_ALGEBRAIC(:,17) = strpad('jss in component INa (dimensionless)');
LEGEND_ALGEBRAIC(:,31) = strpad('tj in component INa (millisecond)');
LEGEND_STATES(:,14) = strpad('j in component INa (dimensionless)');
LEGEND_ALGEBRAIC(:,32) = strpad('hssp in component INa (dimensionless)');
LEGEND_ALGEBRAIC(:,41) = strpad('thsp in component INa (millisecond)');
LEGEND_STATES(:,15) = strpad('hsp in component INa (dimensionless)');
LEGEND_ALGEBRAIC(:,61) = strpad('hp in component INa (dimensionless)');
LEGEND_ALGEBRAIC(:,42) = strpad('tjp in component INa (millisecond)');
LEGEND_STATES(:,16) = strpad('jp in component INa (dimensionless)');
LEGEND_ALGEBRAIC(:,62) = strpad('fINap in component INa (dimensionless)');
LEGEND_ALGEBRAIC(:,33) = strpad('mLss in component INaL (dimensionless)');
LEGEND_ALGEBRAIC(:,43) = strpad('tmL in component INaL (millisecond)');
LEGEND_STATES(:,17) = strpad('mL in component INaL (dimensionless)');
LEGEND_CONSTANTS(:,44) = strpad('thL in component INaL (millisecond)');
LEGEND_ALGEBRAIC(:,3) = strpad('hLss in component INaL (dimensionless)');
LEGEND_STATES(:,18) = strpad('hL in component INaL (dimensionless)');
LEGEND_ALGEBRAIC(:,4) = strpad('hLssp in component INaL (dimensionless)');
LEGEND_CONSTANTS(:,96) = strpad('thLp in component INaL (millisecond)');
LEGEND_STATES(:,19) = strpad('hLp in component INaL (dimensionless)');
LEGEND_CONSTANTS(:,45) = strpad('GNaL_b in component INaL (milliS_per_microF)');
LEGEND_CONSTANTS(:,97) = strpad('GNaL in component INaL (milliS_per_microF)');
LEGEND_ALGEBRAIC(:,64) = strpad('fINaLp in component INaL (dimensionless)');
LEGEND_CONSTANTS(:,46) = strpad('Gto_b in component Ito (milliS_per_microF)');
LEGEND_ALGEBRAIC(:,5) = strpad('ass in component Ito (dimensionless)');
LEGEND_ALGEBRAIC(:,18) = strpad('ta in component Ito (millisecond)');
LEGEND_STATES(:,20) = strpad('a in component Ito (dimensionless)');
LEGEND_ALGEBRAIC(:,6) = strpad('iss in component Ito (dimensionless)');
LEGEND_ALGEBRAIC(:,19) = strpad('delta_epi in component Ito (dimensionless)');
LEGEND_ALGEBRAIC(:,34) = strpad('tiF_b in component Ito (millisecond)');
LEGEND_ALGEBRAIC(:,44) = strpad('tiS_b in component Ito (millisecond)');
LEGEND_ALGEBRAIC(:,47) = strpad('tiF in component Ito (millisecond)');
LEGEND_ALGEBRAIC(:,49) = strpad('tiS in component Ito (millisecond)');
LEGEND_ALGEBRAIC(:,66) = strpad('AiF in component Ito (dimensionless)');
LEGEND_ALGEBRAIC(:,67) = strpad('AiS in component Ito (dimensionless)');
LEGEND_STATES(:,21) = strpad('iF in component Ito (dimensionless)');
LEGEND_STATES(:,22) = strpad('iS in component Ito (dimensionless)');
LEGEND_ALGEBRAIC(:,68) = strpad('i in component Ito (dimensionless)');
LEGEND_ALGEBRAIC(:,35) = strpad('assp in component Ito (dimensionless)');
LEGEND_STATES(:,23) = strpad('ap in component Ito (dimensionless)');
LEGEND_ALGEBRAIC(:,51) = strpad('dti_develop in component Ito (dimensionless)');
LEGEND_ALGEBRAIC(:,53) = strpad('dti_recover in component Ito (dimensionless)');
LEGEND_ALGEBRAIC(:,55) = strpad('tiFp in component Ito (millisecond)');
LEGEND_ALGEBRAIC(:,56) = strpad('tiSp in component Ito (millisecond)');
LEGEND_STATES(:,24) = strpad('iFp in component Ito (dimensionless)');
LEGEND_STATES(:,25) = strpad('iSp in component Ito (dimensionless)');
LEGEND_ALGEBRAIC(:,69) = strpad('ip in component Ito (dimensionless)');
LEGEND_CONSTANTS(:,98) = strpad('Gto in component Ito (milliS_per_microF)');
LEGEND_ALGEBRAIC(:,70) = strpad('fItop in component Ito (dimensionless)');
LEGEND_CONSTANTS(:,47) = strpad('Kmn in component ICaL (millimolar)');
LEGEND_CONSTANTS(:,48) = strpad('k2n in component ICaL (per_millisecond)');
LEGEND_CONSTANTS(:,49) = strpad('PCa_b in component ICaL (dimensionless)');
LEGEND_ALGEBRAIC(:,7) = strpad('dss in component ICaL (dimensionless)');
LEGEND_STATES(:,26) = strpad('d in component ICaL (dimensionless)');
LEGEND_ALGEBRAIC(:,8) = strpad('fss in component ICaL (dimensionless)');
LEGEND_CONSTANTS(:,99) = strpad('Aff in component ICaL (dimensionless)');
LEGEND_CONSTANTS(:,110) = strpad('Afs in component ICaL (dimensionless)');
LEGEND_STATES(:,27) = strpad('ff in component ICaL (dimensionless)');
LEGEND_STATES(:,28) = strpad('fs in component ICaL (dimensionless)');
LEGEND_ALGEBRAIC(:,72) = strpad('f in component ICaL (dimensionless)');
LEGEND_ALGEBRAIC(:,20) = strpad('fcass in component ICaL (dimensionless)');
LEGEND_ALGEBRAIC(:,73) = strpad('Afcaf in component ICaL (dimensionless)');
LEGEND_ALGEBRAIC(:,74) = strpad('Afcas in component ICaL (dimensionless)');
LEGEND_STATES(:,29) = strpad('fcaf in component ICaL (dimensionless)');
LEGEND_STATES(:,30) = strpad('fcas in component ICaL (dimensionless)');
LEGEND_ALGEBRAIC(:,75) = strpad('fca in component ICaL (dimensionless)');
LEGEND_STATES(:,31) = strpad('jca in component ICaL (dimensionless)');
LEGEND_STATES(:,32) = strpad('ffp in component ICaL (dimensionless)');
LEGEND_ALGEBRAIC(:,76) = strpad('fp in component ICaL (dimensionless)');
LEGEND_STATES(:,33) = strpad('fcafp in component ICaL (dimensionless)');
LEGEND_ALGEBRAIC(:,77) = strpad('fcap in component ICaL (dimensionless)');
LEGEND_ALGEBRAIC(:,9) = strpad('km2n in component ICaL (per_millisecond)');
LEGEND_ALGEBRAIC(:,21) = strpad('anca in component ICaL (dimensionless)');
LEGEND_STATES(:,34) = strpad('nca in component ICaL (dimensionless)');
LEGEND_ALGEBRAIC(:,78) = strpad('PhiCaL in component ICaL (dimensionless)');
LEGEND_ALGEBRAIC(:,79) = strpad('PhiCaNa in component ICaL (dimensionless)');
LEGEND_ALGEBRAIC(:,80) = strpad('PhiCaK in component ICaL (dimensionless)');
LEGEND_CONSTANTS(:,100) = strpad('PCa in component ICaL (dimensionless)');
LEGEND_CONSTANTS(:,111) = strpad('PCap in component ICaL (dimensionless)');
LEGEND_CONSTANTS(:,112) = strpad('PCaNa in component ICaL (dimensionless)');
LEGEND_CONSTANTS(:,113) = strpad('PCaK in component ICaL (dimensionless)');
LEGEND_CONSTANTS(:,116) = strpad('PCaNap in component ICaL (dimensionless)');
LEGEND_CONSTANTS(:,117) = strpad('PCaKp in component ICaL (dimensionless)');
LEGEND_ALGEBRAIC(:,81) = strpad('fICaLp in component ICaL (dimensionless)');
LEGEND_ALGEBRAIC(:,22) = strpad('td in component ICaL (millisecond)');
LEGEND_ALGEBRAIC(:,23) = strpad('tff in component ICaL (millisecond)');
LEGEND_ALGEBRAIC(:,24) = strpad('tfs in component ICaL (millisecond)');
LEGEND_ALGEBRAIC(:,36) = strpad('tfcaf in component ICaL (millisecond)');
LEGEND_ALGEBRAIC(:,37) = strpad('tfcas in component ICaL (millisecond)');
LEGEND_CONSTANTS(:,101) = strpad('tjca in component ICaL (millisecond)');
LEGEND_ALGEBRAIC(:,38) = strpad('tffp in component ICaL (millisecond)');
LEGEND_ALGEBRAIC(:,45) = strpad('tfcafp in component ICaL (millisecond)');
LEGEND_CONSTANTS(:,50) = strpad('GKr_b in component IKr (milliS_per_microF)');
LEGEND_CONSTANTS(:,102) = strpad('GKr in component IKr (milliS_per_microF)');
LEGEND_ALGEBRAIC(:,25) = strpad('txrf in component IKr (millisecond)');
LEGEND_ALGEBRAIC(:,26) = strpad('txrs in component IKr (millisecond)');
LEGEND_ALGEBRAIC(:,89) = strpad('Axrf in component IKr (dimensionless)');
LEGEND_ALGEBRAIC(:,92) = strpad('Axrs in component IKr (dimensionless)');
LEGEND_STATES(:,35) = strpad('xrf in component IKr (dimensionless)');
LEGEND_STATES(:,36) = strpad('xrs in component IKr (dimensionless)');
LEGEND_ALGEBRAIC(:,95) = strpad('xr in component IKr (dimensionless)');
LEGEND_ALGEBRAIC(:,96) = strpad('rkr in component IKr (dimensionless)');
LEGEND_CONSTANTS(:,51) = strpad('GKs_b in component IKs (milliS_per_microF)');
LEGEND_CONSTANTS(:,103) = strpad('GKs in component IKs (milliS_per_microF)');
LEGEND_ALGEBRAIC(:,11) = strpad('xs1ss in component IKs (dimensionless)');
LEGEND_ALGEBRAIC(:,27) = strpad('xs2ss in component IKs (dimensionless)');
LEGEND_ALGEBRAIC(:,28) = strpad('txs1 in component IKs (millisecond)');
LEGEND_STATES(:,37) = strpad('xs1 in component IKs (dimensionless)');
LEGEND_STATES(:,38) = strpad('xs2 in component IKs (dimensionless)');
LEGEND_ALGEBRAIC(:,98) = strpad('KsCa in component IKs (dimensionless)');
LEGEND_ALGEBRAIC(:,39) = strpad('txs2 in component IKs (millisecond)');
LEGEND_CONSTANTS(:,104) = strpad('GK1 in component IK1 (milliS_per_microF)');
LEGEND_CONSTANTS(:,52) = strpad('GK1_b in component IK1 (milliS_per_microF)');
LEGEND_ALGEBRAIC(:,12) = strpad('xk1ss in component IK1 (dimensionless)');
LEGEND_ALGEBRAIC(:,29) = strpad('txk1 in component IK1 (millisecond)');
LEGEND_STATES(:,39) = strpad('xk1 in component IK1 (dimensionless)');
LEGEND_ALGEBRAIC(:,100) = strpad('rk1 in component IK1 (millisecond)');
LEGEND_CONSTANTS(:,53) = strpad('kna1 in component INaCa_i (per_millisecond)');
LEGEND_CONSTANTS(:,54) = strpad('kna2 in component INaCa_i (per_millisecond)');
LEGEND_CONSTANTS(:,55) = strpad('kna3 in component INaCa_i (per_millisecond)');
LEGEND_CONSTANTS(:,56) = strpad('kasymm in component INaCa_i (dimensionless)');
LEGEND_CONSTANTS(:,57) = strpad('wna in component INaCa_i (dimensionless)');
LEGEND_CONSTANTS(:,58) = strpad('wca in component INaCa_i (dimensionless)');
LEGEND_CONSTANTS(:,59) = strpad('wnaca in component INaCa_i (dimensionless)');
LEGEND_CONSTANTS(:,60) = strpad('kcaon in component INaCa_i (per_millisecond)');
LEGEND_CONSTANTS(:,61) = strpad('kcaoff in component INaCa_i (per_millisecond)');
LEGEND_CONSTANTS(:,62) = strpad('qna in component INaCa_i (dimensionless)');
LEGEND_CONSTANTS(:,63) = strpad('qca in component INaCa_i (dimensionless)');
LEGEND_ALGEBRAIC(:,103) = strpad('hna in component INaCa_i (dimensionless)');
LEGEND_ALGEBRAIC(:,102) = strpad('hca in component INaCa_i (dimensionless)');
LEGEND_CONSTANTS(:,64) = strpad('KmCaAct in component INaCa_i (millimolar)');
LEGEND_CONSTANTS(:,65) = strpad('Gncx_b in component INaCa_i (milliS_per_microF)');
LEGEND_CONSTANTS(:,129) = strpad('Gncx in component INaCa_i (milliS_per_microF)');
LEGEND_ALGEBRAIC(:,104) = strpad('h1_i in component INaCa_i (dimensionless)');
LEGEND_ALGEBRAIC(:,105) = strpad('h2_i in component INaCa_i (dimensionless)');
LEGEND_ALGEBRAIC(:,106) = strpad('h3_i in component INaCa_i (dimensionless)');
LEGEND_ALGEBRAIC(:,107) = strpad('h4_i in component INaCa_i (dimensionless)');
LEGEND_ALGEBRAIC(:,108) = strpad('h5_i in component INaCa_i (dimensionless)');
LEGEND_ALGEBRAIC(:,109) = strpad('h6_i in component INaCa_i (dimensionless)');
LEGEND_ALGEBRAIC(:,110) = strpad('h7_i in component INaCa_i (dimensionless)');
LEGEND_ALGEBRAIC(:,111) = strpad('h8_i in component INaCa_i (dimensionless)');
LEGEND_ALGEBRAIC(:,112) = strpad('h9_i in component INaCa_i (dimensionless)');
LEGEND_CONSTANTS(:,123) = strpad('h10_i in component INaCa_i (dimensionless)');
LEGEND_CONSTANTS(:,124) = strpad('h11_i in component INaCa_i (dimensionless)');
LEGEND_CONSTANTS(:,125) = strpad('h12_i in component INaCa_i (dimensionless)');
LEGEND_CONSTANTS(:,126) = strpad('k1_i in component INaCa_i (dimensionless)');
LEGEND_CONSTANTS(:,127) = strpad('k2_i in component INaCa_i (dimensionless)');
LEGEND_ALGEBRAIC(:,113) = strpad('k3p_i in component INaCa_i (dimensionless)');
LEGEND_ALGEBRAIC(:,114) = strpad('k3pp_i in component INaCa_i (dimensionless)');
LEGEND_ALGEBRAIC(:,115) = strpad('k3_i in component INaCa_i (dimensionless)');
LEGEND_ALGEBRAIC(:,118) = strpad('k4_i in component INaCa_i (dimensionless)');
LEGEND_ALGEBRAIC(:,116) = strpad('k4p_i in component INaCa_i (dimensionless)');
LEGEND_ALGEBRAIC(:,117) = strpad('k4pp_i in component INaCa_i (dimensionless)');
LEGEND_CONSTANTS(:,128) = strpad('k5_i in component INaCa_i (dimensionless)');
LEGEND_ALGEBRAIC(:,119) = strpad('k6_i in component INaCa_i (dimensionless)');
LEGEND_ALGEBRAIC(:,120) = strpad('k7_i in component INaCa_i (dimensionless)');
LEGEND_ALGEBRAIC(:,121) = strpad('k8_i in component INaCa_i (dimensionless)');
LEGEND_ALGEBRAIC(:,122) = strpad('x1_i in component INaCa_i (dimensionless)');
LEGEND_ALGEBRAIC(:,123) = strpad('x2_i in component INaCa_i (dimensionless)');
LEGEND_ALGEBRAIC(:,124) = strpad('x3_i in component INaCa_i (dimensionless)');
LEGEND_ALGEBRAIC(:,125) = strpad('x4_i in component INaCa_i (dimensionless)');
LEGEND_ALGEBRAIC(:,126) = strpad('E1_i in component INaCa_i (dimensionless)');
LEGEND_ALGEBRAIC(:,127) = strpad('E2_i in component INaCa_i (dimensionless)');
LEGEND_ALGEBRAIC(:,128) = strpad('E3_i in component INaCa_i (dimensionless)');
LEGEND_ALGEBRAIC(:,129) = strpad('E4_i in component INaCa_i (dimensionless)');
LEGEND_ALGEBRAIC(:,130) = strpad('allo_i in component INaCa_i (dimensionless)');
LEGEND_ALGEBRAIC(:,131) = strpad('JncxNa_i in component INaCa_i (millimolar_per_millisecond)');
LEGEND_ALGEBRAIC(:,132) = strpad('JncxCa_i in component INaCa_i (millimolar_per_millisecond)');
LEGEND_ALGEBRAIC(:,134) = strpad('h1_ss in component INaCa_i (dimensionless)');
LEGEND_ALGEBRAIC(:,135) = strpad('h2_ss in component INaCa_i (dimensionless)');
LEGEND_ALGEBRAIC(:,136) = strpad('h3_ss in component INaCa_i (dimensionless)');
LEGEND_ALGEBRAIC(:,137) = strpad('h4_ss in component INaCa_i (dimensionless)');
LEGEND_ALGEBRAIC(:,138) = strpad('h5_ss in component INaCa_i (dimensionless)');
LEGEND_ALGEBRAIC(:,139) = strpad('h6_ss in component INaCa_i (dimensionless)');
LEGEND_ALGEBRAIC(:,140) = strpad('h7_ss in component INaCa_i (dimensionless)');
LEGEND_ALGEBRAIC(:,141) = strpad('h8_ss in component INaCa_i (dimensionless)');
LEGEND_ALGEBRAIC(:,142) = strpad('h9_ss in component INaCa_i (dimensionless)');
LEGEND_CONSTANTS(:,130) = strpad('h10_ss in component INaCa_i (dimensionless)');
LEGEND_CONSTANTS(:,131) = strpad('h11_ss in component INaCa_i (dimensionless)');
LEGEND_CONSTANTS(:,132) = strpad('h12_ss in component INaCa_i (dimensionless)');
LEGEND_CONSTANTS(:,133) = strpad('k1_ss in component INaCa_i (dimensionless)');
LEGEND_CONSTANTS(:,134) = strpad('k2_ss in component INaCa_i (dimensionless)');
LEGEND_ALGEBRAIC(:,143) = strpad('k3p_ss in component INaCa_i (dimensionless)');
LEGEND_ALGEBRAIC(:,144) = strpad('k3pp_ss in component INaCa_i (dimensionless)');
LEGEND_ALGEBRAIC(:,145) = strpad('k3_ss in component INaCa_i (dimensionless)');
LEGEND_ALGEBRAIC(:,148) = strpad('k4_ss in component INaCa_i (dimensionless)');
LEGEND_ALGEBRAIC(:,146) = strpad('k4p_ss in component INaCa_i (dimensionless)');
LEGEND_ALGEBRAIC(:,147) = strpad('k4pp_ss in component INaCa_i (dimensionless)');
LEGEND_CONSTANTS(:,135) = strpad('k5_ss in component INaCa_i (dimensionless)');
LEGEND_ALGEBRAIC(:,149) = strpad('k6_ss in component INaCa_i (dimensionless)');
LEGEND_ALGEBRAIC(:,150) = strpad('k7_ss in component INaCa_i (dimensionless)');
LEGEND_ALGEBRAIC(:,151) = strpad('k8_ss in component INaCa_i (dimensionless)');
LEGEND_ALGEBRAIC(:,152) = strpad('x1_ss in component INaCa_i (dimensionless)');
LEGEND_ALGEBRAIC(:,153) = strpad('x2_ss in component INaCa_i (dimensionless)');
LEGEND_ALGEBRAIC(:,154) = strpad('x3_ss in component INaCa_i (dimensionless)');
LEGEND_ALGEBRAIC(:,155) = strpad('x4_ss in component INaCa_i (dimensionless)');
LEGEND_ALGEBRAIC(:,156) = strpad('E1_ss in component INaCa_i (dimensionless)');
LEGEND_ALGEBRAIC(:,157) = strpad('E2_ss in component INaCa_i (dimensionless)');
LEGEND_ALGEBRAIC(:,158) = strpad('E3_ss in component INaCa_i (dimensionless)');
LEGEND_ALGEBRAIC(:,159) = strpad('E4_ss in component INaCa_i (dimensionless)');
LEGEND_ALGEBRAIC(:,160) = strpad('allo_ss in component INaCa_i (dimensionless)');
LEGEND_ALGEBRAIC(:,161) = strpad('JncxNa_ss in component INaCa_i (millimolar_per_millisecond)');
LEGEND_ALGEBRAIC(:,162) = strpad('JncxCa_ss in component INaCa_i (millimolar_per_millisecond)');
LEGEND_CONSTANTS(:,66) = strpad('k1p in component INaK (per_millisecond)');
LEGEND_CONSTANTS(:,67) = strpad('k1m in component INaK (per_millisecond)');
LEGEND_CONSTANTS(:,68) = strpad('k2p in component INaK (per_millisecond)');
LEGEND_CONSTANTS(:,69) = strpad('k2m in component INaK (per_millisecond)');
LEGEND_CONSTANTS(:,70) = strpad('k3p in component INaK (per_millisecond)');
LEGEND_CONSTANTS(:,71) = strpad('k3m in component INaK (per_millisecond)');
LEGEND_CONSTANTS(:,72) = strpad('k4p in component INaK (per_millisecond)');
LEGEND_CONSTANTS(:,73) = strpad('k4m in component INaK (per_millisecond)');
LEGEND_CONSTANTS(:,74) = strpad('Knai0 in component INaK (millimolar)');
LEGEND_CONSTANTS(:,75) = strpad('Knao0 in component INaK (millimolar)');
LEGEND_CONSTANTS(:,76) = strpad('delta in component INaK (millivolt)');
LEGEND_CONSTANTS(:,77) = strpad('Kki in component INaK (per_millisecond)');
LEGEND_CONSTANTS(:,78) = strpad('Kko in component INaK (per_millisecond)');
LEGEND_CONSTANTS(:,80) = strpad('MgATP in component INaK (millimolar)');
LEGEND_CONSTANTS(:,81) = strpad('Kmgatp in component INaK (millimolar)');
LEGEND_CONSTANTS(:,82) = strpad('H in component INaK (millimolar)');
LEGEND_CONSTANTS(:,83) = strpad('eP in component INaK (dimensionless)');
LEGEND_CONSTANTS(:,84) = strpad('Khp in component INaK (millimolar)');
LEGEND_CONSTANTS(:,85) = strpad('Knap in component INaK (millimolar)');
LEGEND_CONSTANTS(:,86) = strpad('Kxkur in component INaK (millimolar)');
LEGEND_CONSTANTS(:,87) = strpad('Pnak_b in component INaK (milliS_per_microF)');
LEGEND_CONSTANTS(:,139) = strpad('Pnak in component INaK (milliS_per_microF)');
LEGEND_ALGEBRAIC(:,164) = strpad('Knai in component INaK (millimolar)');
LEGEND_ALGEBRAIC(:,165) = strpad('Knao in component INaK (millimolar)');
LEGEND_ALGEBRAIC(:,166) = strpad('P in component INaK (dimensionless)');
LEGEND_ALGEBRAIC(:,167) = strpad('a1 in component INaK (dimensionless)');
LEGEND_CONSTANTS(:,136) = strpad('b1 in component INaK (dimensionless)');
LEGEND_CONSTANTS(:,137) = strpad('a2 in component INaK (dimensionless)');
LEGEND_ALGEBRAIC(:,168) = strpad('b2 in component INaK (dimensionless)');
LEGEND_ALGEBRAIC(:,169) = strpad('a3 in component INaK (dimensionless)');
LEGEND_ALGEBRAIC(:,170) = strpad('b3 in component INaK (dimensionless)');
LEGEND_CONSTANTS(:,138) = strpad('a4 in component INaK (dimensionless)');
LEGEND_ALGEBRAIC(:,171) = strpad('b4 in component INaK (dimensionless)');
LEGEND_ALGEBRAIC(:,172) = strpad('x1 in component INaK (dimensionless)');
LEGEND_ALGEBRAIC(:,173) = strpad('x2 in component INaK (dimensionless)');
LEGEND_ALGEBRAIC(:,174) = strpad('x3 in component INaK (dimensionless)');
LEGEND_ALGEBRAIC(:,175) = strpad('x4 in component INaK (dimensionless)');
LEGEND_ALGEBRAIC(:,176) = strpad('E1 in component INaK (dimensionless)');
LEGEND_ALGEBRAIC(:,177) = strpad('E2 in component INaK (dimensionless)');
LEGEND_ALGEBRAIC(:,178) = strpad('E3 in component INaK (dimensionless)');
LEGEND_ALGEBRAIC(:,179) = strpad('E4 in component INaK (dimensionless)');
LEGEND_ALGEBRAIC(:,180) = strpad('JnakNa in component INaK (millimolar_per_millisecond)');
LEGEND_ALGEBRAIC(:,181) = strpad('JnakK in component INaK (millimolar_per_millisecond)');
LEGEND_ALGEBRAIC(:,183) = strpad('xkb in component IKb (dimensionless)');
LEGEND_CONSTANTS(:,88) = strpad('GKb_b in component IKb (milliS_per_microF)');
LEGEND_CONSTANTS(:,106) = strpad('GKb in component IKb (milliS_per_microF)');
LEGEND_CONSTANTS(:,89) = strpad('PNab in component INab (milliS_per_microF)');
LEGEND_CONSTANTS(:,90) = strpad('PCab in component ICab (milliS_per_microF)');
LEGEND_CONSTANTS(:,91) = strpad('GpCa in component IpCa (milliS_per_microF)');
LEGEND_CONSTANTS(:,92) = strpad('KmCap in component IpCa (millimolar)');
LEGEND_CONSTANTS(:,93) = strpad('bt in component ryr (millisecond)');
LEGEND_CONSTANTS(:,107) = strpad('a_rel in component ryr (millisecond)');
LEGEND_ALGEBRAIC(:,87) = strpad('Jrel_inf in component ryr (dimensionless)');
LEGEND_ALGEBRAIC(:,93) = strpad('tau_rel in component ryr (millisecond)');
LEGEND_ALGEBRAIC(:,88) = strpad('Jrel_infp in component ryr (dimensionless)');
LEGEND_ALGEBRAIC(:,85) = strpad('Jrel_temp in component ryr (dimensionless)');
LEGEND_ALGEBRAIC(:,94) = strpad('tau_relp in component ryr (millisecond)');
LEGEND_STATES(:,40) = strpad('Jrelnp in component ryr (dimensionless)');
LEGEND_STATES(:,41) = strpad('Jrelp in component ryr (dimensionless)');
LEGEND_CONSTANTS(:,108) = strpad('btp in component ryr (millisecond)');
LEGEND_CONSTANTS(:,115) = strpad('a_relp in component ryr (millisecond)');
LEGEND_ALGEBRAIC(:,84) = strpad('Jrel_inf_temp in component ryr (dimensionless)');
LEGEND_ALGEBRAIC(:,191) = strpad('fJrelp in component ryr (dimensionless)');
LEGEND_ALGEBRAIC(:,90) = strpad('tau_rel_temp in component ryr (millisecond)');
LEGEND_ALGEBRAIC(:,91) = strpad('tau_relp_temp in component ryr (millisecond)');
LEGEND_CONSTANTS(:,109) = strpad('upScale in component SERCA (dimensionless)');
LEGEND_ALGEBRAIC(:,193) = strpad('Jupnp in component SERCA (millimolar_per_millisecond)');
LEGEND_ALGEBRAIC(:,194) = strpad('Jupp in component SERCA (millimolar_per_millisecond)');
LEGEND_ALGEBRAIC(:,195) = strpad('fJupp in component SERCA (dimensionless)');
LEGEND_ALGEBRAIC(:,196) = strpad('Jleak in component SERCA (millimolar_per_millisecond)');
LEGEND_RATES(:,1) = strpad('d/dt v in component membrane (millivolt)');
LEGEND_RATES(:,2) = strpad('d/dt CaMKt in component CaMK (millimolar)');
LEGEND_RATES(:,4) = strpad('d/dt nai in component intracellular_ions (millimolar)');
LEGEND_RATES(:,5) = strpad('d/dt nass in component intracellular_ions (millimolar)');
LEGEND_RATES(:,6) = strpad('d/dt ki in component intracellular_ions (millimolar)');
LEGEND_RATES(:,7) = strpad('d/dt kss in component intracellular_ions (millimolar)');
LEGEND_RATES(:,10) = strpad('d/dt cai in component intracellular_ions (millimolar)');
LEGEND_RATES(:,3) = strpad('d/dt cass in component intracellular_ions (millimolar)');
LEGEND_RATES(:,8) = strpad('d/dt cansr in component intracellular_ions (millimolar)');
LEGEND_RATES(:,9) = strpad('d/dt cajsr in component intracellular_ions (millimolar)');
LEGEND_RATES(:,11) = strpad('d/dt m in component INa (dimensionless)');
LEGEND_RATES(:,12) = strpad('d/dt hf in component INa (dimensionless)');
LEGEND_RATES(:,13) = strpad('d/dt hs in component INa (dimensionless)');
LEGEND_RATES(:,14) = strpad('d/dt j in component INa (dimensionless)');
LEGEND_RATES(:,15) = strpad('d/dt hsp in component INa (dimensionless)');
LEGEND_RATES(:,16) = strpad('d/dt jp in component INa (dimensionless)');
LEGEND_RATES(:,17) = strpad('d/dt mL in component INaL (dimensionless)');
LEGEND_RATES(:,18) = strpad('d/dt hL in component INaL (dimensionless)');
LEGEND_RATES(:,19) = strpad('d/dt hLp in component INaL (dimensionless)');
LEGEND_RATES(:,20) = strpad('d/dt a in component Ito (dimensionless)');
LEGEND_RATES(:,21) = strpad('d/dt iF in component Ito (dimensionless)');
LEGEND_RATES(:,22) = strpad('d/dt iS in component Ito (dimensionless)');
LEGEND_RATES(:,23) = strpad('d/dt ap in component Ito (dimensionless)');
LEGEND_RATES(:,24) = strpad('d/dt iFp in component Ito (dimensionless)');
LEGEND_RATES(:,25) = strpad('d/dt iSp in component Ito (dimensionless)');
LEGEND_RATES(:,26) = strpad('d/dt d in component ICaL (dimensionless)');
LEGEND_RATES(:,27) = strpad('d/dt ff in component ICaL (dimensionless)');
LEGEND_RATES(:,28) = strpad('d/dt fs in component ICaL (dimensionless)');
LEGEND_RATES(:,29) = strpad('d/dt fcaf in component ICaL (dimensionless)');
LEGEND_RATES(:,30) = strpad('d/dt fcas in component ICaL (dimensionless)');
LEGEND_RATES(:,31) = strpad('d/dt jca in component ICaL (dimensionless)');
LEGEND_RATES(:,32) = strpad('d/dt ffp in component ICaL (dimensionless)');
LEGEND_RATES(:,33) = strpad('d/dt fcafp in component ICaL (dimensionless)');
LEGEND_RATES(:,34) = strpad('d/dt nca in component ICaL (dimensionless)');
LEGEND_RATES(:,35) = strpad('d/dt xrf in component IKr (dimensionless)');
LEGEND_RATES(:,36) = strpad('d/dt xrs in component IKr (dimensionless)');
LEGEND_RATES(:,37) = strpad('d/dt xs1 in component IKs (dimensionless)');
LEGEND_RATES(:,38) = strpad('d/dt xs2 in component IKs (dimensionless)');
LEGEND_RATES(:,39) = strpad('d/dt xk1 in component IK1 (dimensionless)');
LEGEND_RATES(:,40) = strpad('d/dt Jrelnp in component ryr (dimensionless)');
LEGEND_RATES(:,41) = strpad('d/dt Jrelp in component ryr (dimensionless)');
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 = [];
CONSTANTS(:,1) = 0;
CONSTANTS(:,2) = 140;
CONSTANTS(:,3) = 1.8;
CONSTANTS(:,4) = 5.4;
CONSTANTS(:,5) = 8314;
CONSTANTS(:,6) = 310;
CONSTANTS(:,7) = 96485;
CONSTANTS(:,8) = 1;
CONSTANTS(:,9) = 2;
CONSTANTS(:,10) = 1;
CONSTANTS(:,11) = 0.01;
CONSTANTS(:,12) = 0.0011;
STATES(:,1) = -87;
CONSTANTS(:,13) = -80;
CONSTANTS(:,14) = 0.5;
CONSTANTS(:,15) = 0.15;
CONSTANTS(:,16) = 0.05;
CONSTANTS(:,17) = 0.00068;
CONSTANTS(:,18) = 0.05;
CONSTANTS(:,19) = 0.0015;
STATES(:,2) = 0;
STATES(:,3) = 1e-4;
CONSTANTS(:,20) = 0.05;
CONSTANTS(:,21) = 0.00238;
CONSTANTS(:,22) = 0.07;
CONSTANTS(:,23) = 0.0005;
CONSTANTS(:,24) = 0.047;
CONSTANTS(:,25) = 0.00087;
CONSTANTS(:,26) = 1.124;
CONSTANTS(:,27) = 0.0087;
CONSTANTS(:,28) = 10;
CONSTANTS(:,29) = 0.8;
STATES(:,4) = 7;
STATES(:,5) = 7;
STATES(:,6) = 145;
STATES(:,7) = 145;
STATES(:,8) = 1.2;
STATES(:,9) = 1.2;
STATES(:,10) = 1e-4;
CONSTANTS(:,30) = 1;
CONSTANTS(:,31) = 0.01833;
CONSTANTS(:,32) = 39.57;
CONSTANTS(:,33) = 9.871;
CONSTANTS(:,34) = 11.64;
CONSTANTS(:,35) = 34.77;
CONSTANTS(:,36) = 6.765;
CONSTANTS(:,37) = 8.552;
CONSTANTS(:,38) = 77.42;
CONSTANTS(:,39) = 5.955;
STATES(:,11) = 0;
CONSTANTS(:,40) = 82.9;
CONSTANTS(:,41) = 6.086;
CONSTANTS(:,42) = 0.99;
STATES(:,12) = 1;
STATES(:,13) = 1;
CONSTANTS(:,43) = 75;
STATES(:,14) = 1;
STATES(:,15) = 1;
STATES(:,16) = 1;
STATES(:,17) = 0;
CONSTANTS(:,44) = 200;
STATES(:,18) = 1;
STATES(:,19) = 1;
CONSTANTS(:,45) = 0.0075;
CONSTANTS(:,46) = 0.02;
STATES(:,20) = 0;
STATES(:,21) = 1;
STATES(:,22) = 1;
STATES(:,23) = 0;
STATES(:,24) = 1;
STATES(:,25) = 1;
CONSTANTS(:,47) = 0.002;
CONSTANTS(:,48) = 1000;
CONSTANTS(:,49) = 0.0001;
STATES(:,26) = 0;
STATES(:,27) = 1;
STATES(:,28) = 1;
STATES(:,29) = 1;
STATES(:,30) = 1;
STATES(:,31) = 1;
STATES(:,32) = 1;
STATES(:,33) = 1;
STATES(:,34) = 0;
CONSTANTS(:,50) = 0.046;
STATES(:,35) = 0;
STATES(:,36) = 0;
CONSTANTS(:,51) = 0.0034;
STATES(:,37) = 0;
STATES(:,38) = 0;
CONSTANTS(:,52) = 0.1908;
STATES(:,39) = 1;
CONSTANTS(:,53) = 15;
CONSTANTS(:,54) = 5;
CONSTANTS(:,55) = 88.12;
CONSTANTS(:,56) = 12.5;
CONSTANTS(:,57) = 6e4;
CONSTANTS(:,58) = 6e4;
CONSTANTS(:,59) = 5e3;
CONSTANTS(:,60) = 1.5e6;
CONSTANTS(:,61) = 5e3;
CONSTANTS(:,62) = 0.5224;
CONSTANTS(:,63) = 0.167;
CONSTANTS(:,64) = 150e-6;
CONSTANTS(:,65) = 0.0008;
CONSTANTS(:,66) = 949.5;
CONSTANTS(:,67) = 182.4;
CONSTANTS(:,68) = 687.2;
CONSTANTS(:,69) = 39.4;
CONSTANTS(:,70) = 1899;
CONSTANTS(:,71) = 79300;
CONSTANTS(:,72) = 639;
CONSTANTS(:,73) = 40;
CONSTANTS(:,74) = 9.073;
CONSTANTS(:,75) = 27.78;
CONSTANTS(:,76) = -0.155;
CONSTANTS(:,77) = 0.5;
CONSTANTS(:,78) = 0.3582;
CONSTANTS(:,79) = 0.05;
CONSTANTS(:,80) = 9.8;
CONSTANTS(:,81) = 1.698e-7;
CONSTANTS(:,82) = 1e-7;
CONSTANTS(:,83) = 4.2;
CONSTANTS(:,84) = 1.698e-7;
CONSTANTS(:,85) = 224;
CONSTANTS(:,86) = 292;
CONSTANTS(:,87) = 30;
CONSTANTS(:,88) = 0.003;
CONSTANTS(:,89) = 3.75e-10;
CONSTANTS(:,90) = 2.5e-8;
CONSTANTS(:,91) = 0.0005;
CONSTANTS(:,92) = 0.0005;
CONSTANTS(:,93) = 4.75;
STATES(:,40) = 0;
STATES(:,41) = 0;
CONSTANTS(:,94) = piecewise({CONSTANTS(:,1)==1.00000,  CONSTANTS(:,20).*1.30000 }, CONSTANTS(:,20));
CONSTANTS(:,95) = 1.00000 - CONSTANTS(:,42);
CONSTANTS(:,96) =  3.00000.*CONSTANTS(:,44);
CONSTANTS(:,97) = piecewise({CONSTANTS(:,1)==1.00000,  CONSTANTS(:,45).*0.600000 }, CONSTANTS(:,45));
CONSTANTS(:,98) = piecewise({CONSTANTS(:,1)==1.00000,  CONSTANTS(:,46).*4.00000 , CONSTANTS(:,1)==2.00000,  CONSTANTS(:,46).*4.00000 }, CONSTANTS(:,46));
CONSTANTS(:,99) = 0.600000;
CONSTANTS(:,100) = piecewise({CONSTANTS(:,1)==1.00000,  CONSTANTS(:,49).*1.20000 , CONSTANTS(:,1)==2.00000,  CONSTANTS(:,49).*2.50000 }, CONSTANTS(:,49));
CONSTANTS(:,101) = 75.0000;
CONSTANTS(:,102) = piecewise({CONSTANTS(:,1)==1.00000,  CONSTANTS(:,50).*1.30000 , CONSTANTS(:,1)==2.00000,  CONSTANTS(:,50).*0.800000 }, CONSTANTS(:,50));
CONSTANTS(:,103) = piecewise({CONSTANTS(:,1)==1.00000,  CONSTANTS(:,51).*1.40000 }, CONSTANTS(:,51));
CONSTANTS(:,104) = piecewise({CONSTANTS(:,1)==1.00000,  CONSTANTS(:,52).*1.20000 , CONSTANTS(:,1)==2.00000,  CONSTANTS(:,52).*1.30000 }, CONSTANTS(:,52));
CONSTANTS(:,105) =  1000.00.*3.14000.*CONSTANTS(:,12).*CONSTANTS(:,12).*CONSTANTS(:,11);
CONSTANTS(:,106) = piecewise({CONSTANTS(:,1)==1.00000,  CONSTANTS(:,88).*0.600000 }, CONSTANTS(:,88));
CONSTANTS(:,107) =  0.500000.*CONSTANTS(:,93);
CONSTANTS(:,108) =  1.25000.*CONSTANTS(:,93);
CONSTANTS(:,109) = piecewise({CONSTANTS(:,1)==1.00000, 1.30000 }, 1.00000);
CONSTANTS(:,110) = 1.00000 - CONSTANTS(:,99);
CONSTANTS(:,111) =  1.10000.*CONSTANTS(:,100);
CONSTANTS(:,112) =  0.00125000.*CONSTANTS(:,100);
CONSTANTS(:,113) =  0.000357400.*CONSTANTS(:,100);
CONSTANTS(:,114) =  2.00000.*3.14000.*CONSTANTS(:,12).*CONSTANTS(:,12)+ 2.00000.*3.14000.*CONSTANTS(:,12).*CONSTANTS(:,11);
CONSTANTS(:,115) =  0.500000.*CONSTANTS(:,108);
CONSTANTS(:,116) =  0.00125000.*CONSTANTS(:,111);
CONSTANTS(:,117) =  0.000357400.*CONSTANTS(:,111);
CONSTANTS(:,118) =  2.00000.*CONSTANTS(:,114);
CONSTANTS(:,119) =  0.680000.*CONSTANTS(:,105);
CONSTANTS(:,120) =  0.0552000.*CONSTANTS(:,105);
CONSTANTS(:,121) =  0.00480000.*CONSTANTS(:,105);
CONSTANTS(:,122) =  0.0200000.*CONSTANTS(:,105);
CONSTANTS(:,123) = CONSTANTS(:,56)+1.00000+ (CONSTANTS(:,2)./CONSTANTS(:,53)).*(1.00000+CONSTANTS(:,2)./CONSTANTS(:,54));
CONSTANTS(:,124) = ( CONSTANTS(:,2).*CONSTANTS(:,2))./( CONSTANTS(:,123).*CONSTANTS(:,53).*CONSTANTS(:,54));
CONSTANTS(:,125) = 1.00000./CONSTANTS(:,123);
CONSTANTS(:,126) =  CONSTANTS(:,125).*CONSTANTS(:,3).*CONSTANTS(:,60);
CONSTANTS(:,127) = CONSTANTS(:,61);
CONSTANTS(:,128) = CONSTANTS(:,61);
CONSTANTS(:,129) = piecewise({CONSTANTS(:,1)==1.00000,  CONSTANTS(:,65).*1.10000 , CONSTANTS(:,1)==2.00000,  CONSTANTS(:,65).*1.40000 }, CONSTANTS(:,65));
CONSTANTS(:,130) = CONSTANTS(:,56)+1.00000+ (CONSTANTS(:,2)./CONSTANTS(:,53)).*(1.00000+CONSTANTS(:,2)./CONSTANTS(:,54));
CONSTANTS(:,131) = ( CONSTANTS(:,2).*CONSTANTS(:,2))./( CONSTANTS(:,130).*CONSTANTS(:,53).*CONSTANTS(:,54));
CONSTANTS(:,132) = 1.00000./CONSTANTS(:,130);
CONSTANTS(:,133) =  CONSTANTS(:,132).*CONSTANTS(:,3).*CONSTANTS(:,60);
CONSTANTS(:,134) = CONSTANTS(:,61);
CONSTANTS(:,135) = CONSTANTS(:,61);
CONSTANTS(:,136) =  CONSTANTS(:,67).*CONSTANTS(:,79);
CONSTANTS(:,137) = CONSTANTS(:,68);
CONSTANTS(:,138) = (( CONSTANTS(:,72).*CONSTANTS(:,80))./CONSTANTS(:,81))./(1.00000+CONSTANTS(:,80)./CONSTANTS(:,81));
CONSTANTS(:,139) = piecewise({CONSTANTS(:,1)==1.00000,  CONSTANTS(:,87).*0.900000 , CONSTANTS(:,1)==2.00000,  CONSTANTS(:,87).*0.700000 }, CONSTANTS(:,87));
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);
else
statesRowCount = statesSize(1);
ALGEBRAIC = zeros(statesRowCount, algebraicVariableCount);
RATES = zeros(statesRowCount, statesColumnCount);
end
ALGEBRAIC(:,3) = 1.00000./(1.00000+exp((STATES(:,1)+87.6100)./7.48800));
RATES(:,18) = (ALGEBRAIC(:,3) - STATES(:,18))./CONSTANTS(:,44);
ALGEBRAIC(:,4) = 1.00000./(1.00000+exp((STATES(:,1)+93.8100)./7.48800));
RATES(:,19) = (ALGEBRAIC(:,4) - STATES(:,19))./CONSTANTS(:,96);
ALGEBRAIC(:,1) = 1.00000./(1.00000+exp( - (STATES(:,1)+CONSTANTS(:,32))./CONSTANTS(:,33)));
ALGEBRAIC(:,14) = 1.00000./( CONSTANTS(:,36).*exp((STATES(:,1)+CONSTANTS(:,34))./CONSTANTS(:,35))+ CONSTANTS(:,37).*exp( - (STATES(:,1)+CONSTANTS(:,38))./CONSTANTS(:,39)));
RATES(:,11) = (ALGEBRAIC(:,1) - STATES(:,11))./ALGEBRAIC(:,14);
ALGEBRAIC(:,2) = 1.00000./(1.00000+exp((STATES(:,1)+CONSTANTS(:,40))./CONSTANTS(:,41)));
ALGEBRAIC(:,15) = 1.00000./( 1.43200e-05.*exp( - (STATES(:,1)+1.19600)./6.28500)+ 6.14900.*exp((STATES(:,1)+0.509600)./20.2700));
RATES(:,12) = (ALGEBRAIC(:,2) - STATES(:,12))./ALGEBRAIC(:,15);
ALGEBRAIC(:,16) = 1.00000./( 0.00979400.*exp( - (STATES(:,1)+17.9500)./28.0500)+ 0.334300.*exp((STATES(:,1)+5.73000)./56.6600));
RATES(:,13) = (ALGEBRAIC(:,2) - STATES(:,13))./ALGEBRAIC(:,16);
ALGEBRAIC(:,5) = 1.00000./(1.00000+exp( - (STATES(:,1) - 14.3400)./14.8200));
ALGEBRAIC(:,18) = 1.05150./(1.00000./( 1.20890.*(1.00000+exp( - (STATES(:,1) - 18.4099)./29.3814)))+3.50000./(1.00000+exp((STATES(:,1)+100.000)./29.3814)));
RATES(:,20) = (ALGEBRAIC(:,5) - STATES(:,20))./ALGEBRAIC(:,18);
ALGEBRAIC(:,7) = 1.00000./(1.00000+exp( - (STATES(:,1)+3.94000)./4.23000));
ALGEBRAIC(:,22) = 0.600000+1.00000./(exp(  - 0.0500000.*(STATES(:,1)+6.00000))+exp( 0.0900000.*(STATES(:,1)+14.0000)));
RATES(:,26) = (ALGEBRAIC(:,7) - STATES(:,26))./ALGEBRAIC(:,22);
ALGEBRAIC(:,8) = 1.00000./(1.00000+exp((STATES(:,1)+19.5800)./3.69600));
ALGEBRAIC(:,23) = 7.00000+1.00000./( 0.00450000.*exp( - (STATES(:,1)+20.0000)./10.0000)+ 0.00450000.*exp((STATES(:,1)+20.0000)./10.0000));
RATES(:,27) = (ALGEBRAIC(:,8) - STATES(:,27))./ALGEBRAIC(:,23);
ALGEBRAIC(:,24) = 1000.00+1.00000./( 3.50000e-05.*exp( - (STATES(:,1)+5.00000)./4.00000)+ 3.50000e-05.*exp((STATES(:,1)+5.00000)./6.00000));
RATES(:,28) = (ALGEBRAIC(:,8) - STATES(:,28))./ALGEBRAIC(:,24);
ALGEBRAIC(:,20) = ALGEBRAIC(:,8);
RATES(:,31) = (ALGEBRAIC(:,20) - STATES(:,31))./CONSTANTS(:,101);
ALGEBRAIC(:,9) =  STATES(:,31).*1.00000;
ALGEBRAIC(:,21) = 1.00000./(CONSTANTS(:,48)./ALGEBRAIC(:,9)+power(1.00000+CONSTANTS(:,47)./STATES(:,3), 4.00000));
RATES(:,34) =  ALGEBRAIC(:,21).*CONSTANTS(:,48) -  STATES(:,34).*ALGEBRAIC(:,9);
ALGEBRAIC(:,10) = 1.00000./(1.00000+exp( - (STATES(:,1)+8.33700)./6.78900));
ALGEBRAIC(:,25) = 12.9800+1.00000./( 0.365200.*exp((STATES(:,1) - 31.6600)./3.86900)+ 4.12300e-05.*exp( - (STATES(:,1) - 47.7800)./20.3800));
RATES(:,35) = (ALGEBRAIC(:,10) - STATES(:,35))./ALGEBRAIC(:,25);
ALGEBRAIC(:,26) = 1.86500+1.00000./( 0.0662900.*exp((STATES(:,1) - 34.7000)./7.35500)+ 1.12800e-05.*exp( - (STATES(:,1) - 29.7400)./25.9400));
RATES(:,36) = (ALGEBRAIC(:,10) - STATES(:,36))./ALGEBRAIC(:,26);
ALGEBRAIC(:,11) = 1.00000./(1.00000+exp( - (STATES(:,1)+11.6000)./8.93200));
ALGEBRAIC(:,28) = 817.300+1.00000./( 0.000232600.*exp((STATES(:,1)+48.2800)./17.8000)+ 0.00129200.*exp( - (STATES(:,1)+210.000)./230.000));
RATES(:,37) = (ALGEBRAIC(:,11) - STATES(:,37))./ALGEBRAIC(:,28);
ALGEBRAIC(:,12) = 1.00000./(1.00000+exp( - (STATES(:,1)+ 2.55380.*CONSTANTS(:,4)+144.590)./( 1.56920.*CONSTANTS(:,4)+3.81150)));
ALGEBRAIC(:,29) = 122.200./(exp( - (STATES(:,1)+127.200)./20.3600)+exp((STATES(:,1)+236.800)./69.3300));
RATES(:,39) = (ALGEBRAIC(:,12) - STATES(:,39))./ALGEBRAIC(:,29);
ALGEBRAIC(:,17) = ALGEBRAIC(:,2);
ALGEBRAIC(:,31) = 2.03800+1.00000./( 0.0213600.*exp( - (STATES(:,1)+100.600)./8.28100)+ 0.305200.*exp((STATES(:,1)+0.994100)./38.4500));
RATES(:,14) = (ALGEBRAIC(:,17) - STATES(:,14))./ALGEBRAIC(:,31);
ALGEBRAIC(:,35) = 1.00000./(1.00000+exp( - (STATES(:,1) - 24.3400)./14.8200));
RATES(:,23) = (ALGEBRAIC(:,35) - STATES(:,23))./ALGEBRAIC(:,18);
ALGEBRAIC(:,36) = 7.00000+1.00000./( 0.0400000.*exp( - (STATES(:,1) - 4.00000)./7.00000)+ 0.0400000.*exp((STATES(:,1) - 4.00000)./7.00000));
RATES(:,29) = (ALGEBRAIC(:,20) - STATES(:,29))./ALGEBRAIC(:,36);
ALGEBRAIC(:,37) = 100.000+1.00000./( 0.000120000.*exp( - STATES(:,1)./3.00000)+ 0.000120000.*exp(STATES(:,1)./7.00000));
RATES(:,30) = (ALGEBRAIC(:,20) - STATES(:,30))./ALGEBRAIC(:,37);
ALGEBRAIC(:,38) =  2.50000.*ALGEBRAIC(:,23);
RATES(:,32) = (ALGEBRAIC(:,8) - STATES(:,32))./ALGEBRAIC(:,38);
ALGEBRAIC(:,27) = ALGEBRAIC(:,11);
ALGEBRAIC(:,39) = 1.00000./( 0.0100000.*exp((STATES(:,1) - 50.0000)./20.0000)+ 0.0193000.*exp( - (STATES(:,1)+66.5400)./31.0000));
RATES(:,38) = (ALGEBRAIC(:,27) - STATES(:,38))./ALGEBRAIC(:,39);
ALGEBRAIC(:,46) = ( CONSTANTS(:,18).*(1.00000 - STATES(:,2)))./(1.00000+CONSTANTS(:,19)./STATES(:,3));
RATES(:,2) =  CONSTANTS(:,16).*ALGEBRAIC(:,46).*(ALGEBRAIC(:,46)+STATES(:,2)) -  CONSTANTS(:,17).*STATES(:,2);
ALGEBRAIC(:,32) = 1.00000./(1.00000+exp((STATES(:,1)+89.1000)./6.08600));
ALGEBRAIC(:,41) =  3.00000.*ALGEBRAIC(:,16);
RATES(:,15) = (ALGEBRAIC(:,32) - STATES(:,15))./ALGEBRAIC(:,41);
ALGEBRAIC(:,42) =  1.46000.*ALGEBRAIC(:,31);
RATES(:,16) = (ALGEBRAIC(:,17) - STATES(:,16))./ALGEBRAIC(:,42);
ALGEBRAIC(:,33) = 1.00000./(1.00000+exp( - (STATES(:,1)+42.8500)./5.26400));
ALGEBRAIC(:,43) = ALGEBRAIC(:,14);
RATES(:,17) = (ALGEBRAIC(:,33) - STATES(:,17))./ALGEBRAIC(:,43);
ALGEBRAIC(:,45) =  2.50000.*ALGEBRAIC(:,36);
RATES(:,33) = (ALGEBRAIC(:,20) - STATES(:,33))./ALGEBRAIC(:,45);
ALGEBRAIC(:,6) = 1.00000./(1.00000+exp((STATES(:,1)+43.9400)./5.71100));
ALGEBRAIC(:,19) = piecewise({CONSTANTS(:,1)==1.00000, 1.00000 - 0.950000./(1.00000+exp((STATES(:,1)+70.0000)./5.00000)) }, 1.00000);
ALGEBRAIC(:,34) = 4.56200+1.00000./( 0.393300.*exp( - (STATES(:,1)+100.000)./100.000)+ 0.0800400.*exp((STATES(:,1)+50.0000)./16.5900));
ALGEBRAIC(:,47) =  ALGEBRAIC(:,34).*ALGEBRAIC(:,19);
RATES(:,21) = (ALGEBRAIC(:,6) - STATES(:,21))./ALGEBRAIC(:,47);
ALGEBRAIC(:,44) = 23.6200+1.00000./( 0.00141600.*exp( - (STATES(:,1)+96.5200)./59.0500)+ 1.78000e-08.*exp((STATES(:,1)+114.100)./8.07900));
ALGEBRAIC(:,49) =  ALGEBRAIC(:,44).*ALGEBRAIC(:,19);
RATES(:,22) = (ALGEBRAIC(:,6) - STATES(:,22))./ALGEBRAIC(:,49);
ALGEBRAIC(:,51) = 1.35400+0.000100000./(exp((STATES(:,1) - 167.400)./15.8900)+exp( - (STATES(:,1) - 12.2300)./0.215400));
ALGEBRAIC(:,53) = 1.00000 - 0.500000./(1.00000+exp((STATES(:,1)+70.0000)./20.0000));
ALGEBRAIC(:,55) =  ALGEBRAIC(:,51).*ALGEBRAIC(:,53).*ALGEBRAIC(:,47);
RATES(:,24) = (ALGEBRAIC(:,6) - STATES(:,24))./ALGEBRAIC(:,55);
ALGEBRAIC(:,56) =  ALGEBRAIC(:,51).*ALGEBRAIC(:,53).*ALGEBRAIC(:,49);
RATES(:,25) = (ALGEBRAIC(:,6) - STATES(:,25))./ALGEBRAIC(:,56);
ALGEBRAIC(:,72) =  CONSTANTS(:,99).*STATES(:,27)+ CONSTANTS(:,110).*STATES(:,28);
ALGEBRAIC(:,73) = 0.300000+0.600000./(1.00000+exp((STATES(:,1) - 10.0000)./10.0000));
ALGEBRAIC(:,74) = 1.00000 - ALGEBRAIC(:,73);
ALGEBRAIC(:,75) =  ALGEBRAIC(:,73).*STATES(:,29)+ ALGEBRAIC(:,74).*STATES(:,30);
ALGEBRAIC(:,76) =  CONSTANTS(:,99).*STATES(:,32)+ CONSTANTS(:,110).*STATES(:,28);
ALGEBRAIC(:,77) =  ALGEBRAIC(:,73).*STATES(:,33)+ ALGEBRAIC(:,74).*STATES(:,30);
ALGEBRAIC(:,30) = ( STATES(:,1).*CONSTANTS(:,7).*CONSTANTS(:,7))./( CONSTANTS(:,5).*CONSTANTS(:,6));
ALGEBRAIC(:,40) = ( STATES(:,1).*CONSTANTS(:,7))./( CONSTANTS(:,5).*CONSTANTS(:,6));
ALGEBRAIC(:,78) = ( 4.00000.*ALGEBRAIC(:,30).*( STATES(:,3).*exp( 2.00000.*ALGEBRAIC(:,40)) -  0.341000.*CONSTANTS(:,3)))./(exp( 2.00000.*ALGEBRAIC(:,40)) - 1.00000);
ALGEBRAIC(:,48) = ALGEBRAIC(:,46)+STATES(:,2);
ALGEBRAIC(:,81) = 1.00000./(1.00000+CONSTANTS(:,15)./ALGEBRAIC(:,48));
ALGEBRAIC(:,82) =  (1.00000 - ALGEBRAIC(:,81)).*CONSTANTS(:,100).*ALGEBRAIC(:,78).*STATES(:,26).*( ALGEBRAIC(:,72).*(1.00000 - STATES(:,34))+ STATES(:,31).*ALGEBRAIC(:,75).*STATES(:,34))+ ALGEBRAIC(:,81).*CONSTANTS(:,111).*ALGEBRAIC(:,78).*STATES(:,26).*( ALGEBRAIC(:,76).*(1.00000 - STATES(:,34))+ STATES(:,31).*ALGEBRAIC(:,77).*STATES(:,34));
ALGEBRAIC(:,84) = ( CONSTANTS(:,107).* - ALGEBRAIC(:,82))./(1.00000+ 1.00000.*power(1.50000./STATES(:,9), 8.00000));
ALGEBRAIC(:,87) = piecewise({CONSTANTS(:,1)==2.00000,  ALGEBRAIC(:,84).*1.70000 }, ALGEBRAIC(:,84));
ALGEBRAIC(:,90) = CONSTANTS(:,93)./(1.00000+0.0123000./STATES(:,9));
ALGEBRAIC(:,93) = piecewise({ALGEBRAIC(:,90)<0.00100000, 0.00100000 }, ALGEBRAIC(:,90));
RATES(:,40) = (ALGEBRAIC(:,87) - STATES(:,40))./ALGEBRAIC(:,93);
ALGEBRAIC(:,85) = ( CONSTANTS(:,115).* - ALGEBRAIC(:,82))./(1.00000+power(1.50000./STATES(:,9), 8.00000));
ALGEBRAIC(:,88) = piecewise({CONSTANTS(:,1)==2.00000,  ALGEBRAIC(:,85).*1.70000 }, ALGEBRAIC(:,85));
ALGEBRAIC(:,91) = CONSTANTS(:,108)./(1.00000+0.0123000./STATES(:,9));
ALGEBRAIC(:,94) = piecewise({ALGEBRAIC(:,91)<0.00100000, 0.00100000 }, ALGEBRAIC(:,91));
RATES(:,41) = (ALGEBRAIC(:,88) - STATES(:,41))./ALGEBRAIC(:,94);
ALGEBRAIC(:,58) =  (( CONSTANTS(:,5).*CONSTANTS(:,6))./CONSTANTS(:,7)).*log(CONSTANTS(:,4)./STATES(:,6));
ALGEBRAIC(:,66) = 1.00000./(1.00000+exp((STATES(:,1) - 213.600)./151.200));
ALGEBRAIC(:,67) = 1.00000 - ALGEBRAIC(:,66);
ALGEBRAIC(:,68) =  ALGEBRAIC(:,66).*STATES(:,21)+ ALGEBRAIC(:,67).*STATES(:,22);
ALGEBRAIC(:,69) =  ALGEBRAIC(:,66).*STATES(:,24)+ ALGEBRAIC(:,67).*STATES(:,25);
ALGEBRAIC(:,70) = 1.00000./(1.00000+CONSTANTS(:,15)./ALGEBRAIC(:,48));
ALGEBRAIC(:,71) =  CONSTANTS(:,98).*(STATES(:,1) - ALGEBRAIC(:,58)).*( (1.00000 - ALGEBRAIC(:,70)).*STATES(:,20).*ALGEBRAIC(:,68)+ ALGEBRAIC(:,70).*STATES(:,23).*ALGEBRAIC(:,69));
ALGEBRAIC(:,89) = 1.00000./(1.00000+exp((STATES(:,1)+54.8100)./38.2100));
ALGEBRAIC(:,92) = 1.00000 - ALGEBRAIC(:,89);
ALGEBRAIC(:,95) =  ALGEBRAIC(:,89).*STATES(:,35)+ ALGEBRAIC(:,92).*STATES(:,36);
ALGEBRAIC(:,96) = ( (1.00000./(1.00000+exp((STATES(:,1)+55.0000)./75.0000))).*1.00000)./(1.00000+exp((STATES(:,1) - 10.0000)./30.0000));
ALGEBRAIC(:,97) =  CONSTANTS(:,102).*power((CONSTANTS(:,4)./5.40000), 1.0 ./ 2).*ALGEBRAIC(:,95).*ALGEBRAIC(:,96).*(STATES(:,1) - ALGEBRAIC(:,58));
ALGEBRAIC(:,59) =  (( CONSTANTS(:,5).*CONSTANTS(:,6))./CONSTANTS(:,7)).*log((CONSTANTS(:,4)+ CONSTANTS(:,31).*CONSTANTS(:,2))./(STATES(:,6)+ CONSTANTS(:,31).*STATES(:,4)));
ALGEBRAIC(:,98) = 1.00000+0.600000./(1.00000+power(3.80000e-05./STATES(:,10), 1.40000));
ALGEBRAIC(:,99) =  CONSTANTS(:,103).*ALGEBRAIC(:,98).*STATES(:,37).*STATES(:,38).*(STATES(:,1) - ALGEBRAIC(:,59));
ALGEBRAIC(:,100) = 1.00000./(1.00000+exp(((STATES(:,1)+105.800) -  2.60000.*CONSTANTS(:,4))./9.49300));
ALGEBRAIC(:,101) =  CONSTANTS(:,104).*power(CONSTANTS(:,4), 1.0 ./ 2).*ALGEBRAIC(:,100).*STATES(:,39).*(STATES(:,1) - ALGEBRAIC(:,58));
ALGEBRAIC(:,165) =  CONSTANTS(:,75).*exp(( (1.00000 - CONSTANTS(:,76)).*STATES(:,1).*CONSTANTS(:,7))./( 3.00000.*CONSTANTS(:,5).*CONSTANTS(:,6)));
ALGEBRAIC(:,169) = ( CONSTANTS(:,70).*power(CONSTANTS(:,4)./CONSTANTS(:,78), 2.00000))./((power(1.00000+CONSTANTS(:,2)./ALGEBRAIC(:,165), 3.00000)+power(1.00000+CONSTANTS(:,4)./CONSTANTS(:,78), 2.00000)) - 1.00000);
ALGEBRAIC(:,166) = CONSTANTS(:,83)./(1.00000+CONSTANTS(:,82)./CONSTANTS(:,84)+STATES(:,4)./CONSTANTS(:,85)+STATES(:,6)./CONSTANTS(:,86));
ALGEBRAIC(:,170) = ( CONSTANTS(:,71).*ALGEBRAIC(:,166).*CONSTANTS(:,82))./(1.00000+CONSTANTS(:,80)./CONSTANTS(:,81));
ALGEBRAIC(:,164) =  CONSTANTS(:,74).*exp(( CONSTANTS(:,76).*STATES(:,1).*CONSTANTS(:,7))./( 3.00000.*CONSTANTS(:,5).*CONSTANTS(:,6)));
ALGEBRAIC(:,167) = ( CONSTANTS(:,66).*power(STATES(:,4)./ALGEBRAIC(:,164), 3.00000))./((power(1.00000+STATES(:,4)./ALGEBRAIC(:,164), 3.00000)+power(1.00000+STATES(:,6)./CONSTANTS(:,77), 2.00000)) - 1.00000);
ALGEBRAIC(:,168) = ( CONSTANTS(:,69).*power(CONSTANTS(:,2)./ALGEBRAIC(:,165), 3.00000))./((power(1.00000+CONSTANTS(:,2)./ALGEBRAIC(:,165), 3.00000)+power(1.00000+CONSTANTS(:,4)./CONSTANTS(:,78), 2.00000)) - 1.00000);
ALGEBRAIC(:,171) = ( CONSTANTS(:,73).*power(STATES(:,6)./CONSTANTS(:,77), 2.00000))./((power(1.00000+STATES(:,4)./ALGEBRAIC(:,164), 3.00000)+power(1.00000+STATES(:,6)./CONSTANTS(:,77), 2.00000)) - 1.00000);
ALGEBRAIC(:,172) =  CONSTANTS(:,138).*ALGEBRAIC(:,167).*CONSTANTS(:,137)+ ALGEBRAIC(:,168).*ALGEBRAIC(:,171).*ALGEBRAIC(:,170)+ CONSTANTS(:,137).*ALGEBRAIC(:,171).*ALGEBRAIC(:,170)+ ALGEBRAIC(:,170).*ALGEBRAIC(:,167).*CONSTANTS(:,137);
ALGEBRAIC(:,173) =  ALGEBRAIC(:,168).*CONSTANTS(:,136).*ALGEBRAIC(:,171)+ ALGEBRAIC(:,167).*CONSTANTS(:,137).*ALGEBRAIC(:,169)+ ALGEBRAIC(:,169).*CONSTANTS(:,136).*ALGEBRAIC(:,171)+ CONSTANTS(:,137).*ALGEBRAIC(:,169).*ALGEBRAIC(:,171);
ALGEBRAIC(:,174) =  CONSTANTS(:,137).*ALGEBRAIC(:,169).*CONSTANTS(:,138)+ ALGEBRAIC(:,170).*ALGEBRAIC(:,168).*CONSTANTS(:,136)+ ALGEBRAIC(:,168).*CONSTANTS(:,136).*CONSTANTS(:,138)+ ALGEBRAIC(:,169).*CONSTANTS(:,138).*CONSTANTS(:,136);
ALGEBRAIC(:,175) =  ALGEBRAIC(:,171).*ALGEBRAIC(:,170).*ALGEBRAIC(:,168)+ ALGEBRAIC(:,169).*CONSTANTS(:,138).*ALGEBRAIC(:,167)+ ALGEBRAIC(:,168).*CONSTANTS(:,138).*ALGEBRAIC(:,167)+ ALGEBRAIC(:,170).*ALGEBRAIC(:,168).*ALGEBRAIC(:,167);
ALGEBRAIC(:,176) = ALGEBRAIC(:,172)./(ALGEBRAIC(:,172)+ALGEBRAIC(:,173)+ALGEBRAIC(:,174)+ALGEBRAIC(:,175));
ALGEBRAIC(:,177) = ALGEBRAIC(:,173)./(ALGEBRAIC(:,172)+ALGEBRAIC(:,173)+ALGEBRAIC(:,174)+ALGEBRAIC(:,175));
ALGEBRAIC(:,180) =  3.00000.*( ALGEBRAIC(:,176).*ALGEBRAIC(:,169) -  ALGEBRAIC(:,177).*ALGEBRAIC(:,170));
ALGEBRAIC(:,178) = ALGEBRAIC(:,174)./(ALGEBRAIC(:,172)+ALGEBRAIC(:,173)+ALGEBRAIC(:,174)+ALGEBRAIC(:,175));
ALGEBRAIC(:,179) = ALGEBRAIC(:,175)./(ALGEBRAIC(:,172)+ALGEBRAIC(:,173)+ALGEBRAIC(:,174)+ALGEBRAIC(:,175));
ALGEBRAIC(:,181) =  2.00000.*( ALGEBRAIC(:,179).*CONSTANTS(:,136) -  ALGEBRAIC(:,178).*ALGEBRAIC(:,167));
ALGEBRAIC(:,182) =  CONSTANTS(:,139).*( CONSTANTS(:,8).*ALGEBRAIC(:,180)+ CONSTANTS(:,10).*ALGEBRAIC(:,181));
ALGEBRAIC(:,183) = 1.00000./(1.00000+exp( - (STATES(:,1) - 14.4800)./18.3400));
ALGEBRAIC(:,184) =  CONSTANTS(:,106).*ALGEBRAIC(:,183).*(STATES(:,1) - ALGEBRAIC(:,58));
ALGEBRAIC(:,13) = piecewise({VOI<=CONSTANTS(:,14), CONSTANTS(:,13) }, 0.00000);
ALGEBRAIC(:,186) = (STATES(:,7) - STATES(:,6))./2.00000;
RATES(:,6) = (  - ((ALGEBRAIC(:,71)+ALGEBRAIC(:,97)+ALGEBRAIC(:,99)+ALGEBRAIC(:,101)+ALGEBRAIC(:,184)+ALGEBRAIC(:,13)) -  2.00000.*ALGEBRAIC(:,182)).*CONSTANTS(:,30).*CONSTANTS(:,118))./( CONSTANTS(:,7).*CONSTANTS(:,119))+( ALGEBRAIC(:,186).*CONSTANTS(:,122))./CONSTANTS(:,119);
ALGEBRAIC(:,80) = ( 1.00000.*ALGEBRAIC(:,30).*( 0.750000.*STATES(:,7).*exp( 1.00000.*ALGEBRAIC(:,40)) -  0.750000.*CONSTANTS(:,4)))./(exp( 1.00000.*ALGEBRAIC(:,40)) - 1.00000);
ALGEBRAIC(:,86) =  (1.00000 - ALGEBRAIC(:,81)).*CONSTANTS(:,113).*ALGEBRAIC(:,80).*STATES(:,26).*( ALGEBRAIC(:,72).*(1.00000 - STATES(:,34))+ STATES(:,31).*ALGEBRAIC(:,75).*STATES(:,34))+ ALGEBRAIC(:,81).*CONSTANTS(:,117).*ALGEBRAIC(:,80).*STATES(:,26).*( ALGEBRAIC(:,76).*(1.00000 - STATES(:,34))+ STATES(:,31).*ALGEBRAIC(:,77).*STATES(:,34));
RATES(:,7) = (  - ALGEBRAIC(:,86).*CONSTANTS(:,30).*CONSTANTS(:,118))./( CONSTANTS(:,7).*CONSTANTS(:,122)) - ALGEBRAIC(:,186);
ALGEBRAIC(:,57) =  (( CONSTANTS(:,5).*CONSTANTS(:,6))./CONSTANTS(:,7)).*log(CONSTANTS(:,2)./STATES(:,4));
ALGEBRAIC(:,60) =  CONSTANTS(:,42).*STATES(:,12)+ CONSTANTS(:,95).*STATES(:,13);
ALGEBRAIC(:,61) =  CONSTANTS(:,42).*STATES(:,12)+ CONSTANTS(:,95).*STATES(:,15);
ALGEBRAIC(:,62) = 1.00000./(1.00000+CONSTANTS(:,15)./ALGEBRAIC(:,48));
ALGEBRAIC(:,63) =  CONSTANTS(:,43).*(STATES(:,1) - ALGEBRAIC(:,57)).*power(STATES(:,11), 3.00000).*( (1.00000 - ALGEBRAIC(:,62)).*ALGEBRAIC(:,60).*STATES(:,14)+ ALGEBRAIC(:,62).*ALGEBRAIC(:,61).*STATES(:,16));
ALGEBRAIC(:,64) = 1.00000./(1.00000+CONSTANTS(:,15)./ALGEBRAIC(:,48));
ALGEBRAIC(:,65) =  CONSTANTS(:,97).*(STATES(:,1) - ALGEBRAIC(:,57)).*STATES(:,17).*( (1.00000 - ALGEBRAIC(:,64)).*STATES(:,18)+ ALGEBRAIC(:,64).*STATES(:,19));
ALGEBRAIC(:,130) = 1.00000./(1.00000+power(CONSTANTS(:,64)./STATES(:,10), 2.00000));
ALGEBRAIC(:,103) = exp(( CONSTANTS(:,62).*STATES(:,1).*CONSTANTS(:,7))./( CONSTANTS(:,5).*CONSTANTS(:,6)));
ALGEBRAIC(:,110) = 1.00000+ (CONSTANTS(:,2)./CONSTANTS(:,55)).*(1.00000+1.00000./ALGEBRAIC(:,103));
ALGEBRAIC(:,111) = CONSTANTS(:,2)./( CONSTANTS(:,55).*ALGEBRAIC(:,103).*ALGEBRAIC(:,110));
ALGEBRAIC(:,114) =  ALGEBRAIC(:,111).*CONSTANTS(:,59);
ALGEBRAIC(:,104) = 1.00000+ (STATES(:,4)./CONSTANTS(:,55)).*(1.00000+ALGEBRAIC(:,103));
ALGEBRAIC(:,105) = ( STATES(:,4).*ALGEBRAIC(:,103))./( CONSTANTS(:,55).*ALGEBRAIC(:,104));
ALGEBRAIC(:,117) =  ALGEBRAIC(:,105).*CONSTANTS(:,59);
ALGEBRAIC(:,107) = 1.00000+ (STATES(:,4)./CONSTANTS(:,53)).*(1.00000+STATES(:,4)./CONSTANTS(:,54));
ALGEBRAIC(:,108) = ( STATES(:,4).*STATES(:,4))./( ALGEBRAIC(:,107).*CONSTANTS(:,53).*CONSTANTS(:,54));
ALGEBRAIC(:,120) =  ALGEBRAIC(:,108).*ALGEBRAIC(:,105).*CONSTANTS(:,57);
ALGEBRAIC(:,121) =  ALGEBRAIC(:,111).*CONSTANTS(:,124).*CONSTANTS(:,57);
ALGEBRAIC(:,112) = 1.00000./ALGEBRAIC(:,110);
ALGEBRAIC(:,113) =  ALGEBRAIC(:,112).*CONSTANTS(:,58);
ALGEBRAIC(:,115) = ALGEBRAIC(:,113)+ALGEBRAIC(:,114);
ALGEBRAIC(:,102) = exp(( CONSTANTS(:,63).*STATES(:,1).*CONSTANTS(:,7))./( CONSTANTS(:,5).*CONSTANTS(:,6)));
ALGEBRAIC(:,106) = 1.00000./ALGEBRAIC(:,104);
ALGEBRAIC(:,116) = ( ALGEBRAIC(:,106).*CONSTANTS(:,58))./ALGEBRAIC(:,102);
ALGEBRAIC(:,118) = ALGEBRAIC(:,116)+ALGEBRAIC(:,117);
ALGEBRAIC(:,109) = 1.00000./ALGEBRAIC(:,107);
ALGEBRAIC(:,119) =  ALGEBRAIC(:,109).*STATES(:,10).*CONSTANTS(:,60);
ALGEBRAIC(:,122) =  CONSTANTS(:,127).*ALGEBRAIC(:,118).*(ALGEBRAIC(:,120)+ALGEBRAIC(:,119))+ CONSTANTS(:,128).*ALGEBRAIC(:,120).*(CONSTANTS(:,127)+ALGEBRAIC(:,115));
ALGEBRAIC(:,123) =  CONSTANTS(:,126).*ALGEBRAIC(:,120).*(ALGEBRAIC(:,118)+CONSTANTS(:,128))+ ALGEBRAIC(:,118).*ALGEBRAIC(:,119).*(CONSTANTS(:,126)+ALGEBRAIC(:,121));
ALGEBRAIC(:,124) =  CONSTANTS(:,126).*ALGEBRAIC(:,115).*(ALGEBRAIC(:,120)+ALGEBRAIC(:,119))+ ALGEBRAIC(:,121).*ALGEBRAIC(:,119).*(CONSTANTS(:,127)+ALGEBRAIC(:,115));
ALGEBRAIC(:,125) =  CONSTANTS(:,127).*ALGEBRAIC(:,121).*(ALGEBRAIC(:,118)+CONSTANTS(:,128))+ ALGEBRAIC(:,115).*CONSTANTS(:,128).*(CONSTANTS(:,126)+ALGEBRAIC(:,121));
ALGEBRAIC(:,126) = ALGEBRAIC(:,122)./(ALGEBRAIC(:,122)+ALGEBRAIC(:,123)+ALGEBRAIC(:,124)+ALGEBRAIC(:,125));
ALGEBRAIC(:,127) = ALGEBRAIC(:,123)./(ALGEBRAIC(:,122)+ALGEBRAIC(:,123)+ALGEBRAIC(:,124)+ALGEBRAIC(:,125));
ALGEBRAIC(:,128) = ALGEBRAIC(:,124)./(ALGEBRAIC(:,122)+ALGEBRAIC(:,123)+ALGEBRAIC(:,124)+ALGEBRAIC(:,125));
ALGEBRAIC(:,129) = ALGEBRAIC(:,125)./(ALGEBRAIC(:,122)+ALGEBRAIC(:,123)+ALGEBRAIC(:,124)+ALGEBRAIC(:,125));
ALGEBRAIC(:,131) = ( 3.00000.*( ALGEBRAIC(:,129).*ALGEBRAIC(:,120) -  ALGEBRAIC(:,126).*ALGEBRAIC(:,121))+ ALGEBRAIC(:,128).*ALGEBRAIC(:,117)) -  ALGEBRAIC(:,127).*ALGEBRAIC(:,114);
ALGEBRAIC(:,132) =  ALGEBRAIC(:,127).*CONSTANTS(:,127) -  ALGEBRAIC(:,126).*CONSTANTS(:,126);
ALGEBRAIC(:,133) =  0.800000.*CONSTANTS(:,129).*ALGEBRAIC(:,130).*( CONSTANTS(:,8).*ALGEBRAIC(:,131)+ CONSTANTS(:,9).*ALGEBRAIC(:,132));
ALGEBRAIC(:,185) = ( CONSTANTS(:,89).*ALGEBRAIC(:,30).*( STATES(:,4).*exp(ALGEBRAIC(:,40)) - CONSTANTS(:,2)))./(exp(ALGEBRAIC(:,40)) - 1.00000);
ALGEBRAIC(:,188) = (STATES(:,5) - STATES(:,4))./2.00000;
RATES(:,4) = (  - (ALGEBRAIC(:,63)+ALGEBRAIC(:,65)+ 3.00000.*ALGEBRAIC(:,133)+ 3.00000.*ALGEBRAIC(:,182)+ALGEBRAIC(:,185)).*CONSTANTS(:,118).*CONSTANTS(:,30))./( CONSTANTS(:,7).*CONSTANTS(:,119))+( ALGEBRAIC(:,188).*CONSTANTS(:,122))./CONSTANTS(:,119);
ALGEBRAIC(:,79) = ( 1.00000.*ALGEBRAIC(:,30).*( 0.750000.*STATES(:,5).*exp( 1.00000.*ALGEBRAIC(:,40)) -  0.750000.*CONSTANTS(:,2)))./(exp( 1.00000.*ALGEBRAIC(:,40)) - 1.00000);
ALGEBRAIC(:,83) =  (1.00000 - ALGEBRAIC(:,81)).*CONSTANTS(:,112).*ALGEBRAIC(:,79).*STATES(:,26).*( ALGEBRAIC(:,72).*(1.00000 - STATES(:,34))+ STATES(:,31).*ALGEBRAIC(:,75).*STATES(:,34))+ ALGEBRAIC(:,81).*CONSTANTS(:,116).*ALGEBRAIC(:,79).*STATES(:,26).*( ALGEBRAIC(:,76).*(1.00000 - STATES(:,34))+ STATES(:,31).*ALGEBRAIC(:,77).*STATES(:,34));
ALGEBRAIC(:,160) = 1.00000./(1.00000+power(CONSTANTS(:,64)./STATES(:,3), 2.00000));
ALGEBRAIC(:,140) = 1.00000+ (CONSTANTS(:,2)./CONSTANTS(:,55)).*(1.00000+1.00000./ALGEBRAIC(:,103));
ALGEBRAIC(:,141) = CONSTANTS(:,2)./( CONSTANTS(:,55).*ALGEBRAIC(:,103).*ALGEBRAIC(:,140));
ALGEBRAIC(:,144) =  ALGEBRAIC(:,141).*CONSTANTS(:,59);
ALGEBRAIC(:,134) = 1.00000+ (STATES(:,5)./CONSTANTS(:,55)).*(1.00000+ALGEBRAIC(:,103));
ALGEBRAIC(:,135) = ( STATES(:,5).*ALGEBRAIC(:,103))./( CONSTANTS(:,55).*ALGEBRAIC(:,134));
ALGEBRAIC(:,147) =  ALGEBRAIC(:,135).*CONSTANTS(:,59);
ALGEBRAIC(:,137) = 1.00000+ (STATES(:,5)./CONSTANTS(:,53)).*(1.00000+STATES(:,5)./CONSTANTS(:,54));
ALGEBRAIC(:,138) = ( STATES(:,5).*STATES(:,5))./( ALGEBRAIC(:,137).*CONSTANTS(:,53).*CONSTANTS(:,54));
ALGEBRAIC(:,150) =  ALGEBRAIC(:,138).*ALGEBRAIC(:,135).*CONSTANTS(:,57);
ALGEBRAIC(:,151) =  ALGEBRAIC(:,141).*CONSTANTS(:,131).*CONSTANTS(:,57);
ALGEBRAIC(:,142) = 1.00000./ALGEBRAIC(:,140);
ALGEBRAIC(:,143) =  ALGEBRAIC(:,142).*CONSTANTS(:,58);
ALGEBRAIC(:,145) = ALGEBRAIC(:,143)+ALGEBRAIC(:,144);
ALGEBRAIC(:,136) = 1.00000./ALGEBRAIC(:,134);
ALGEBRAIC(:,146) = ( ALGEBRAIC(:,136).*CONSTANTS(:,58))./ALGEBRAIC(:,102);
ALGEBRAIC(:,148) = ALGEBRAIC(:,146)+ALGEBRAIC(:,147);
ALGEBRAIC(:,139) = 1.00000./ALGEBRAIC(:,137);
ALGEBRAIC(:,149) =  ALGEBRAIC(:,139).*STATES(:,3).*CONSTANTS(:,60);
ALGEBRAIC(:,152) =  CONSTANTS(:,134).*ALGEBRAIC(:,148).*(ALGEBRAIC(:,150)+ALGEBRAIC(:,149))+ CONSTANTS(:,135).*ALGEBRAIC(:,150).*(CONSTANTS(:,134)+ALGEBRAIC(:,145));
ALGEBRAIC(:,153) =  CONSTANTS(:,133).*ALGEBRAIC(:,150).*(ALGEBRAIC(:,148)+CONSTANTS(:,135))+ ALGEBRAIC(:,148).*ALGEBRAIC(:,149).*(CONSTANTS(:,133)+ALGEBRAIC(:,151));
ALGEBRAIC(:,154) =  CONSTANTS(:,133).*ALGEBRAIC(:,145).*(ALGEBRAIC(:,150)+ALGEBRAIC(:,149))+ ALGEBRAIC(:,151).*ALGEBRAIC(:,149).*(CONSTANTS(:,134)+ALGEBRAIC(:,145));
ALGEBRAIC(:,155) =  CONSTANTS(:,134).*ALGEBRAIC(:,151).*(ALGEBRAIC(:,148)+CONSTANTS(:,135))+ ALGEBRAIC(:,145).*CONSTANTS(:,135).*(CONSTANTS(:,133)+ALGEBRAIC(:,151));
ALGEBRAIC(:,156) = ALGEBRAIC(:,152)./(ALGEBRAIC(:,152)+ALGEBRAIC(:,153)+ALGEBRAIC(:,154)+ALGEBRAIC(:,155));
ALGEBRAIC(:,157) = ALGEBRAIC(:,153)./(ALGEBRAIC(:,152)+ALGEBRAIC(:,153)+ALGEBRAIC(:,154)+ALGEBRAIC(:,155));
ALGEBRAIC(:,158) = ALGEBRAIC(:,154)./(ALGEBRAIC(:,152)+ALGEBRAIC(:,153)+ALGEBRAIC(:,154)+ALGEBRAIC(:,155));
ALGEBRAIC(:,159) = ALGEBRAIC(:,155)./(ALGEBRAIC(:,152)+ALGEBRAIC(:,153)+ALGEBRAIC(:,154)+ALGEBRAIC(:,155));
ALGEBRAIC(:,161) = ( 3.00000.*( ALGEBRAIC(:,159).*ALGEBRAIC(:,150) -  ALGEBRAIC(:,156).*ALGEBRAIC(:,151))+ ALGEBRAIC(:,158).*ALGEBRAIC(:,147)) -  ALGEBRAIC(:,157).*ALGEBRAIC(:,144);
ALGEBRAIC(:,162) =  ALGEBRAIC(:,157).*CONSTANTS(:,134) -  ALGEBRAIC(:,156).*CONSTANTS(:,133);
ALGEBRAIC(:,163) =  0.200000.*CONSTANTS(:,129).*ALGEBRAIC(:,160).*( CONSTANTS(:,8).*ALGEBRAIC(:,161)+ CONSTANTS(:,9).*ALGEBRAIC(:,162));
RATES(:,5) = (  - (ALGEBRAIC(:,83)+ 3.00000.*ALGEBRAIC(:,163)).*CONSTANTS(:,30).*CONSTANTS(:,118))./( CONSTANTS(:,7).*CONSTANTS(:,122)) - ALGEBRAIC(:,188);
ALGEBRAIC(:,189) = ( CONSTANTS(:,91).*STATES(:,10))./(CONSTANTS(:,92)+STATES(:,10));
ALGEBRAIC(:,187) = ( CONSTANTS(:,90).*4.00000.*ALGEBRAIC(:,30).*( STATES(:,10).*exp( 2.00000.*ALGEBRAIC(:,40)) -  0.341000.*CONSTANTS(:,3)))./(exp( 2.00000.*ALGEBRAIC(:,40)) - 1.00000);
RATES(:,1) =  - (ALGEBRAIC(:,63)+ALGEBRAIC(:,65)+ALGEBRAIC(:,71)+ALGEBRAIC(:,82)+ALGEBRAIC(:,83)+ALGEBRAIC(:,86)+ALGEBRAIC(:,97)+ALGEBRAIC(:,99)+ALGEBRAIC(:,101)+ALGEBRAIC(:,133)+ALGEBRAIC(:,163)+ALGEBRAIC(:,182)+ALGEBRAIC(:,185)+ALGEBRAIC(:,184)+ALGEBRAIC(:,189)+ALGEBRAIC(:,187)+ALGEBRAIC(:,13));
ALGEBRAIC(:,190) = (STATES(:,3) - STATES(:,10))./0.200000;
ALGEBRAIC(:,191) = 1.00000./(1.00000+CONSTANTS(:,15)./ALGEBRAIC(:,48));
ALGEBRAIC(:,192) =  (1.00000 - ALGEBRAIC(:,191)).*STATES(:,40)+ ALGEBRAIC(:,191).*STATES(:,41);
ALGEBRAIC(:,52) = 1.00000./(1.00000+( CONSTANTS(:,24).*CONSTANTS(:,25))./power(CONSTANTS(:,25)+STATES(:,3), 2.00000)+( CONSTANTS(:,26).*CONSTANTS(:,27))./power(CONSTANTS(:,27)+STATES(:,3), 2.00000));
RATES(:,3) =  ALGEBRAIC(:,52).*(((  - (ALGEBRAIC(:,82) -  2.00000.*ALGEBRAIC(:,163)).*CONSTANTS(:,30).*CONSTANTS(:,118))./( 2.00000.*CONSTANTS(:,7).*CONSTANTS(:,122))+( ALGEBRAIC(:,192).*CONSTANTS(:,121))./CONSTANTS(:,122)) - ALGEBRAIC(:,190));
ALGEBRAIC(:,193) = ( CONSTANTS(:,109).*0.00437500.*STATES(:,10))./(STATES(:,10)+0.000920000);
ALGEBRAIC(:,194) = ( CONSTANTS(:,109).*2.75000.*0.00437500.*STATES(:,10))./((STATES(:,10)+0.000920000) - 0.000170000);
ALGEBRAIC(:,195) = 1.00000./(1.00000+CONSTANTS(:,15)./ALGEBRAIC(:,48));
ALGEBRAIC(:,196) = ( 0.00393750.*STATES(:,8))./15.0000;
ALGEBRAIC(:,197) = ( (1.00000 - ALGEBRAIC(:,195)).*ALGEBRAIC(:,193)+ ALGEBRAIC(:,195).*ALGEBRAIC(:,194)) - ALGEBRAIC(:,196);
ALGEBRAIC(:,50) = 1.00000./(1.00000+( CONSTANTS(:,94).*CONSTANTS(:,21))./power(CONSTANTS(:,21)+STATES(:,10), 2.00000)+( CONSTANTS(:,22).*CONSTANTS(:,23))./power(CONSTANTS(:,23)+STATES(:,10), 2.00000));
RATES(:,10) =  ALGEBRAIC(:,50).*(((  - ((ALGEBRAIC(:,189)+ALGEBRAIC(:,187)) -  2.00000.*ALGEBRAIC(:,133)).*CONSTANTS(:,30).*CONSTANTS(:,118))./( 2.00000.*CONSTANTS(:,7).*CONSTANTS(:,119)) - ( ALGEBRAIC(:,197).*CONSTANTS(:,120))./CONSTANTS(:,119))+( ALGEBRAIC(:,190).*CONSTANTS(:,122))./CONSTANTS(:,119));
ALGEBRAIC(:,198) = (STATES(:,8) - STATES(:,9))./100.000;
RATES(:,8) = ALGEBRAIC(:,197) - ( ALGEBRAIC(:,198).*CONSTANTS(:,121))./CONSTANTS(:,120);
ALGEBRAIC(:,54) = 1.00000./(1.00000+( CONSTANTS(:,28).*CONSTANTS(:,29))./power(CONSTANTS(:,29)+STATES(:,9), 2.00000));
RATES(:,9) =  ALGEBRAIC(:,54).*(ALGEBRAIC(:,198) - ALGEBRAIC(:,192));
RATES = RATES';
end

% Calculate algebraic variables
function ALGEBRAIC = computeAlgebraic(ALGEBRAIC, CONSTANTS, STATES, VOI)
ALGEBRAIC(:,3) = 1.00000./(1.00000+exp((STATES(:,1)+87.6100)./7.48800));
ALGEBRAIC(:,4) = 1.00000./(1.00000+exp((STATES(:,1)+93.8100)./7.48800));
ALGEBRAIC(:,1) = 1.00000./(1.00000+exp( - (STATES(:,1)+CONSTANTS(:,32))./CONSTANTS(:,33)));
ALGEBRAIC(:,14) = 1.00000./( CONSTANTS(:,36).*exp((STATES(:,1)+CONSTANTS(:,34))./CONSTANTS(:,35))+ CONSTANTS(:,37).*exp( - (STATES(:,1)+CONSTANTS(:,38))./CONSTANTS(:,39)));
ALGEBRAIC(:,2) = 1.00000./(1.00000+exp((STATES(:,1)+CONSTANTS(:,40))./CONSTANTS(:,41)));
ALGEBRAIC(:,15) = 1.00000./( 1.43200e-05.*exp( - (STATES(:,1)+1.19600)./6.28500)+ 6.14900.*exp((STATES(:,1)+0.509600)./20.2700));
ALGEBRAIC(:,16) = 1.00000./( 0.00979400.*exp( - (STATES(:,1)+17.9500)./28.0500)+ 0.334300.*exp((STATES(:,1)+5.73000)./56.6600));
ALGEBRAIC(:,5) = 1.00000./(1.00000+exp( - (STATES(:,1) - 14.3400)./14.8200));
ALGEBRAIC(:,18) = 1.05150./(1.00000./( 1.20890.*(1.00000+exp( - (STATES(:,1) - 18.4099)./29.3814)))+3.50000./(1.00000+exp((STATES(:,1)+100.000)./29.3814)));
ALGEBRAIC(:,7) = 1.00000./(1.00000+exp( - (STATES(:,1)+3.94000)./4.23000));
ALGEBRAIC(:,22) = 0.600000+1.00000./(exp(  - 0.0500000.*(STATES(:,1)+6.00000))+exp( 0.0900000.*(STATES(:,1)+14.0000)));
ALGEBRAIC(:,8) = 1.00000./(1.00000+exp((STATES(:,1)+19.5800)./3.69600));
ALGEBRAIC(:,23) = 7.00000+1.00000./( 0.00450000.*exp( - (STATES(:,1)+20.0000)./10.0000)+ 0.00450000.*exp((STATES(:,1)+20.0000)./10.0000));
ALGEBRAIC(:,24) = 1000.00+1.00000./( 3.50000e-05.*exp( - (STATES(:,1)+5.00000)./4.00000)+ 3.50000e-05.*exp((STATES(:,1)+5.00000)./6.00000));
ALGEBRAIC(:,20) = ALGEBRAIC(:,8);
ALGEBRAIC(:,9) =  STATES(:,31).*1.00000;
ALGEBRAIC(:,21) = 1.00000./(CONSTANTS(:,48)./ALGEBRAIC(:,9)+power(1.00000+CONSTANTS(:,47)./STATES(:,3), 4.00000));
ALGEBRAIC(:,10) = 1.00000./(1.00000+exp( - (STATES(:,1)+8.33700)./6.78900));
ALGEBRAIC(:,25) = 12.9800+1.00000./( 0.365200.*exp((STATES(:,1) - 31.6600)./3.86900)+ 4.12300e-05.*exp( - (STATES(:,1) - 47.7800)./20.3800));
ALGEBRAIC(:,26) = 1.86500+1.00000./( 0.0662900.*exp((STATES(:,1) - 34.7000)./7.35500)+ 1.12800e-05.*exp( - (STATES(:,1) - 29.7400)./25.9400));
ALGEBRAIC(:,11) = 1.00000./(1.00000+exp( - (STATES(:,1)+11.6000)./8.93200));
ALGEBRAIC(:,28) = 817.300+1.00000./( 0.000232600.*exp((STATES(:,1)+48.2800)./17.8000)+ 0.00129200.*exp( - (STATES(:,1)+210.000)./230.000));
ALGEBRAIC(:,12) = 1.00000./(1.00000+exp( - (STATES(:,1)+ 2.55380.*CONSTANTS(:,4)+144.590)./( 1.56920.*CONSTANTS(:,4)+3.81150)));
ALGEBRAIC(:,29) = 122.200./(exp( - (STATES(:,1)+127.200)./20.3600)+exp((STATES(:,1)+236.800)./69.3300));
ALGEBRAIC(:,17) = ALGEBRAIC(:,2);
ALGEBRAIC(:,31) = 2.03800+1.00000./( 0.0213600.*exp( - (STATES(:,1)+100.600)./8.28100)+ 0.305200.*exp((STATES(:,1)+0.994100)./38.4500));
ALGEBRAIC(:,35) = 1.00000./(1.00000+exp( - (STATES(:,1) - 24.3400)./14.8200));
ALGEBRAIC(:,36) = 7.00000+1.00000./( 0.0400000.*exp( - (STATES(:,1) - 4.00000)./7.00000)+ 0.0400000.*exp((STATES(:,1) - 4.00000)./7.00000));
ALGEBRAIC(:,37) = 100.000+1.00000./( 0.000120000.*exp( - STATES(:,1)./3.00000)+ 0.000120000.*exp(STATES(:,1)./7.00000));
ALGEBRAIC(:,38) =  2.50000.*ALGEBRAIC(:,23);
ALGEBRAIC(:,27) = ALGEBRAIC(:,11);
ALGEBRAIC(:,39) = 1.00000./( 0.0100000.*exp((STATES(:,1) - 50.0000)./20.0000)+ 0.0193000.*exp( - (STATES(:,1)+66.5400)./31.0000));
ALGEBRAIC(:,46) = ( CONSTANTS(:,18).*(1.00000 - STATES(:,2)))./(1.00000+CONSTANTS(:,19)./STATES(:,3));
ALGEBRAIC(:,32) = 1.00000./(1.00000+exp((STATES(:,1)+89.1000)./6.08600));
ALGEBRAIC(:,41) =  3.00000.*ALGEBRAIC(:,16);
ALGEBRAIC(:,42) =  1.46000.*ALGEBRAIC(:,31);
ALGEBRAIC(:,33) = 1.00000./(1.00000+exp( - (STATES(:,1)+42.8500)./5.26400));
ALGEBRAIC(:,43) = ALGEBRAIC(:,14);
ALGEBRAIC(:,45) =  2.50000.*ALGEBRAIC(:,36);
ALGEBRAIC(:,6) = 1.00000./(1.00000+exp((STATES(:,1)+43.9400)./5.71100));
ALGEBRAIC(:,19) = piecewise({CONSTANTS(:,1)==1.00000, 1.00000 - 0.950000./(1.00000+exp((STATES(:,1)+70.0000)./5.00000)) }, 1.00000);
ALGEBRAIC(:,34) = 4.56200+1.00000./( 0.393300.*exp( - (STATES(:,1)+100.000)./100.000)+ 0.0800400.*exp((STATES(:,1)+50.0000)./16.5900));
ALGEBRAIC(:,47) =  ALGEBRAIC(:,34).*ALGEBRAIC(:,19);
ALGEBRAIC(:,44) = 23.6200+1.00000./( 0.00141600.*exp( - (STATES(:,1)+96.5200)./59.0500)+ 1.78000e-08.*exp((STATES(:,1)+114.100)./8.07900));
ALGEBRAIC(:,49) =  ALGEBRAIC(:,44).*ALGEBRAIC(:,19);
ALGEBRAIC(:,51) = 1.35400+0.000100000./(exp((STATES(:,1) - 167.400)./15.8900)+exp( - (STATES(:,1) - 12.2300)./0.215400));
ALGEBRAIC(:,53) = 1.00000 - 0.500000./(1.00000+exp((STATES(:,1)+70.0000)./20.0000));
ALGEBRAIC(:,55) =  ALGEBRAIC(:,51).*ALGEBRAIC(:,53).*ALGEBRAIC(:,47);
ALGEBRAIC(:,56) =  ALGEBRAIC(:,51).*ALGEBRAIC(:,53).*ALGEBRAIC(:,49);
ALGEBRAIC(:,72) =  CONSTANTS(:,99).*STATES(:,27)+ CONSTANTS(:,110).*STATES(:,28);
ALGEBRAIC(:,73) = 0.300000+0.600000./(1.00000+exp((STATES(:,1) - 10.0000)./10.0000));
ALGEBRAIC(:,74) = 1.00000 - ALGEBRAIC(:,73);
ALGEBRAIC(:,75) =  ALGEBRAIC(:,73).*STATES(:,29)+ ALGEBRAIC(:,74).*STATES(:,30);
ALGEBRAIC(:,76) =  CONSTANTS(:,99).*STATES(:,32)+ CONSTANTS(:,110).*STATES(:,28);
ALGEBRAIC(:,77) =  ALGEBRAIC(:,73).*STATES(:,33)+ ALGEBRAIC(:,74).*STATES(:,30);
ALGEBRAIC(:,30) = ( STATES(:,1).*CONSTANTS(:,7).*CONSTANTS(:,7))./( CONSTANTS(:,5).*CONSTANTS(:,6));
ALGEBRAIC(:,40) = ( STATES(:,1).*CONSTANTS(:,7))./( CONSTANTS(:,5).*CONSTANTS(:,6));
ALGEBRAIC(:,78) = ( 4.00000.*ALGEBRAIC(:,30).*( STATES(:,3).*exp( 2.00000.*ALGEBRAIC(:,40)) -  0.341000.*CONSTANTS(:,3)))./(exp( 2.00000.*ALGEBRAIC(:,40)) - 1.00000);
ALGEBRAIC(:,48) = ALGEBRAIC(:,46)+STATES(:,2);
ALGEBRAIC(:,81) = 1.00000./(1.00000+CONSTANTS(:,15)./ALGEBRAIC(:,48));
ALGEBRAIC(:,82) =  (1.00000 - ALGEBRAIC(:,81)).*CONSTANTS(:,100).*ALGEBRAIC(:,78).*STATES(:,26).*( ALGEBRAIC(:,72).*(1.00000 - STATES(:,34))+ STATES(:,31).*ALGEBRAIC(:,75).*STATES(:,34))+ ALGEBRAIC(:,81).*CONSTANTS(:,111).*ALGEBRAIC(:,78).*STATES(:,26).*( ALGEBRAIC(:,76).*(1.00000 - STATES(:,34))+ STATES(:,31).*ALGEBRAIC(:,77).*STATES(:,34));
ALGEBRAIC(:,84) = ( CONSTANTS(:,107).* - ALGEBRAIC(:,82))./(1.00000+ 1.00000.*power(1.50000./STATES(:,9), 8.00000));
ALGEBRAIC(:,87) = piecewise({CONSTANTS(:,1)==2.00000,  ALGEBRAIC(:,84).*1.70000 }, ALGEBRAIC(:,84));
ALGEBRAIC(:,90) = CONSTANTS(:,93)./(1.00000+0.0123000./STATES(:,9));
ALGEBRAIC(:,93) = piecewise({ALGEBRAIC(:,90)<0.00100000, 0.00100000 }, ALGEBRAIC(:,90));
ALGEBRAIC(:,85) = ( CONSTANTS(:,115).* - ALGEBRAIC(:,82))./(1.00000+power(1.50000./STATES(:,9), 8.00000));
ALGEBRAIC(:,88) = piecewise({CONSTANTS(:,1)==2.00000,  ALGEBRAIC(:,85).*1.70000 }, ALGEBRAIC(:,85));
ALGEBRAIC(:,91) = CONSTANTS(:,108)./(1.00000+0.0123000./STATES(:,9));
ALGEBRAIC(:,94) = piecewise({ALGEBRAIC(:,91)<0.00100000, 0.00100000 }, ALGEBRAIC(:,91));
ALGEBRAIC(:,58) =  (( CONSTANTS(:,5).*CONSTANTS(:,6))./CONSTANTS(:,7)).*log(CONSTANTS(:,4)./STATES(:,6));
ALGEBRAIC(:,66) = 1.00000./(1.00000+exp((STATES(:,1) - 213.600)./151.200));
ALGEBRAIC(:,67) = 1.00000 - ALGEBRAIC(:,66);
ALGEBRAIC(:,68) =  ALGEBRAIC(:,66).*STATES(:,21)+ ALGEBRAIC(:,67).*STATES(:,22);
ALGEBRAIC(:,69) =  ALGEBRAIC(:,66).*STATES(:,24)+ ALGEBRAIC(:,67).*STATES(:,25);
ALGEBRAIC(:,70) = 1.00000./(1.00000+CONSTANTS(:,15)./ALGEBRAIC(:,48));
ALGEBRAIC(:,71) =  CONSTANTS(:,98).*(STATES(:,1) - ALGEBRAIC(:,58)).*( (1.00000 - ALGEBRAIC(:,70)).*STATES(:,20).*ALGEBRAIC(:,68)+ ALGEBRAIC(:,70).*STATES(:,23).*ALGEBRAIC(:,69));
ALGEBRAIC(:,89) = 1.00000./(1.00000+exp((STATES(:,1)+54.8100)./38.2100));
ALGEBRAIC(:,92) = 1.00000 - ALGEBRAIC(:,89);
ALGEBRAIC(:,95) =  ALGEBRAIC(:,89).*STATES(:,35)+ ALGEBRAIC(:,92).*STATES(:,36);
ALGEBRAIC(:,96) = ( (1.00000./(1.00000+exp((STATES(:,1)+55.0000)./75.0000))).*1.00000)./(1.00000+exp((STATES(:,1) - 10.0000)./30.0000));
ALGEBRAIC(:,97) =  CONSTANTS(:,102).*power((CONSTANTS(:,4)./5.40000), 1.0 ./ 2).*ALGEBRAIC(:,95).*ALGEBRAIC(:,96).*(STATES(:,1) - ALGEBRAIC(:,58));
ALGEBRAIC(:,59) =  (( CONSTANTS(:,5).*CONSTANTS(:,6))./CONSTANTS(:,7)).*log((CONSTANTS(:,4)+ CONSTANTS(:,31).*CONSTANTS(:,2))./(STATES(:,6)+ CONSTANTS(:,31).*STATES(:,4)));
ALGEBRAIC(:,98) = 1.00000+0.600000./(1.00000+power(3.80000e-05./STATES(:,10), 1.40000));
ALGEBRAIC(:,99) =  CONSTANTS(:,103).*ALGEBRAIC(:,98).*STATES(:,37).*STATES(:,38).*(STATES(:,1) - ALGEBRAIC(:,59));
ALGEBRAIC(:,100) = 1.00000./(1.00000+exp(((STATES(:,1)+105.800) -  2.60000.*CONSTANTS(:,4))./9.49300));
ALGEBRAIC(:,101) =  CONSTANTS(:,104).*power(CONSTANTS(:,4), 1.0 ./ 2).*ALGEBRAIC(:,100).*STATES(:,39).*(STATES(:,1) - ALGEBRAIC(:,58));
ALGEBRAIC(:,165) =  CONSTANTS(:,75).*exp(( (1.00000 - CONSTANTS(:,76)).*STATES(:,1).*CONSTANTS(:,7))./( 3.00000.*CONSTANTS(:,5).*CONSTANTS(:,6)));
ALGEBRAIC(:,169) = ( CONSTANTS(:,70).*power(CONSTANTS(:,4)./CONSTANTS(:,78), 2.00000))./((power(1.00000+CONSTANTS(:,2)./ALGEBRAIC(:,165), 3.00000)+power(1.00000+CONSTANTS(:,4)./CONSTANTS(:,78), 2.00000)) - 1.00000);
ALGEBRAIC(:,166) = CONSTANTS(:,83)./(1.00000+CONSTANTS(:,82)./CONSTANTS(:,84)+STATES(:,4)./CONSTANTS(:,85)+STATES(:,6)./CONSTANTS(:,86));
ALGEBRAIC(:,170) = ( CONSTANTS(:,71).*ALGEBRAIC(:,166).*CONSTANTS(:,82))./(1.00000+CONSTANTS(:,80)./CONSTANTS(:,81));
ALGEBRAIC(:,164) =  CONSTANTS(:,74).*exp(( CONSTANTS(:,76).*STATES(:,1).*CONSTANTS(:,7))./( 3.00000.*CONSTANTS(:,5).*CONSTANTS(:,6)));
ALGEBRAIC(:,167) = ( CONSTANTS(:,66).*power(STATES(:,4)./ALGEBRAIC(:,164), 3.00000))./((power(1.00000+STATES(:,4)./ALGEBRAIC(:,164), 3.00000)+power(1.00000+STATES(:,6)./CONSTANTS(:,77), 2.00000)) - 1.00000);
ALGEBRAIC(:,168) = ( CONSTANTS(:,69).*power(CONSTANTS(:,2)./ALGEBRAIC(:,165), 3.00000))./((power(1.00000+CONSTANTS(:,2)./ALGEBRAIC(:,165), 3.00000)+power(1.00000+CONSTANTS(:,4)./CONSTANTS(:,78), 2.00000)) - 1.00000);
ALGEBRAIC(:,171) = ( CONSTANTS(:,73).*power(STATES(:,6)./CONSTANTS(:,77), 2.00000))./((power(1.00000+STATES(:,4)./ALGEBRAIC(:,164), 3.00000)+power(1.00000+STATES(:,6)./CONSTANTS(:,77), 2.00000)) - 1.00000);
ALGEBRAIC(:,172) =  CONSTANTS(:,138).*ALGEBRAIC(:,167).*CONSTANTS(:,137)+ ALGEBRAIC(:,168).*ALGEBRAIC(:,171).*ALGEBRAIC(:,170)+ CONSTANTS(:,137).*ALGEBRAIC(:,171).*ALGEBRAIC(:,170)+ ALGEBRAIC(:,170).*ALGEBRAIC(:,167).*CONSTANTS(:,137);
ALGEBRAIC(:,173) =  ALGEBRAIC(:,168).*CONSTANTS(:,136).*ALGEBRAIC(:,171)+ ALGEBRAIC(:,167).*CONSTANTS(:,137).*ALGEBRAIC(:,169)+ ALGEBRAIC(:,169).*CONSTANTS(:,136).*ALGEBRAIC(:,171)+ CONSTANTS(:,137).*ALGEBRAIC(:,169).*ALGEBRAIC(:,171);
ALGEBRAIC(:,174) =  CONSTANTS(:,137).*ALGEBRAIC(:,169).*CONSTANTS(:,138)+ ALGEBRAIC(:,170).*ALGEBRAIC(:,168).*CONSTANTS(:,136)+ ALGEBRAIC(:,168).*CONSTANTS(:,136).*CONSTANTS(:,138)+ ALGEBRAIC(:,169).*CONSTANTS(:,138).*CONSTANTS(:,136);
ALGEBRAIC(:,175) =  ALGEBRAIC(:,171).*ALGEBRAIC(:,170).*ALGEBRAIC(:,168)+ ALGEBRAIC(:,169).*CONSTANTS(:,138).*ALGEBRAIC(:,167)+ ALGEBRAIC(:,168).*CONSTANTS(:,138).*ALGEBRAIC(:,167)+ ALGEBRAIC(:,170).*ALGEBRAIC(:,168).*ALGEBRAIC(:,167);
ALGEBRAIC(:,176) = ALGEBRAIC(:,172)./(ALGEBRAIC(:,172)+ALGEBRAIC(:,173)+ALGEBRAIC(:,174)+ALGEBRAIC(:,175));
ALGEBRAIC(:,177) = ALGEBRAIC(:,173)./(ALGEBRAIC(:,172)+ALGEBRAIC(:,173)+ALGEBRAIC(:,174)+ALGEBRAIC(:,175));
ALGEBRAIC(:,180) =  3.00000.*( ALGEBRAIC(:,176).*ALGEBRAIC(:,169) -  ALGEBRAIC(:,177).*ALGEBRAIC(:,170));
ALGEBRAIC(:,178) = ALGEBRAIC(:,174)./(ALGEBRAIC(:,172)+ALGEBRAIC(:,173)+ALGEBRAIC(:,174)+ALGEBRAIC(:,175));
ALGEBRAIC(:,179) = ALGEBRAIC(:,175)./(ALGEBRAIC(:,172)+ALGEBRAIC(:,173)+ALGEBRAIC(:,174)+ALGEBRAIC(:,175));
ALGEBRAIC(:,181) =  2.00000.*( ALGEBRAIC(:,179).*CONSTANTS(:,136) -  ALGEBRAIC(:,178).*ALGEBRAIC(:,167));
ALGEBRAIC(:,182) =  CONSTANTS(:,139).*( CONSTANTS(:,8).*ALGEBRAIC(:,180)+ CONSTANTS(:,10).*ALGEBRAIC(:,181));
ALGEBRAIC(:,183) = 1.00000./(1.00000+exp( - (STATES(:,1) - 14.4800)./18.3400));
ALGEBRAIC(:,184) =  CONSTANTS(:,106).*ALGEBRAIC(:,183).*(STATES(:,1) - ALGEBRAIC(:,58));
ALGEBRAIC(:,13) = piecewise({VOI<=CONSTANTS(:,14), CONSTANTS(:,13) }, 0.00000);
ALGEBRAIC(:,186) = (STATES(:,7) - STATES(:,6))./2.00000;
ALGEBRAIC(:,80) = ( 1.00000.*ALGEBRAIC(:,30).*( 0.750000.*STATES(:,7).*exp( 1.00000.*ALGEBRAIC(:,40)) -  0.750000.*CONSTANTS(:,4)))./(exp( 1.00000.*ALGEBRAIC(:,40)) - 1.00000);
ALGEBRAIC(:,86) =  (1.00000 - ALGEBRAIC(:,81)).*CONSTANTS(:,113).*ALGEBRAIC(:,80).*STATES(:,26).*( ALGEBRAIC(:,72).*(1.00000 - STATES(:,34))+ STATES(:,31).*ALGEBRAIC(:,75).*STATES(:,34))+ ALGEBRAIC(:,81).*CONSTANTS(:,117).*ALGEBRAIC(:,80).*STATES(:,26).*( ALGEBRAIC(:,76).*(1.00000 - STATES(:,34))+ STATES(:,31).*ALGEBRAIC(:,77).*STATES(:,34));
ALGEBRAIC(:,57) =  (( CONSTANTS(:,5).*CONSTANTS(:,6))./CONSTANTS(:,7)).*log(CONSTANTS(:,2)./STATES(:,4));
ALGEBRAIC(:,60) =  CONSTANTS(:,42).*STATES(:,12)+ CONSTANTS(:,95).*STATES(:,13);
ALGEBRAIC(:,61) =  CONSTANTS(:,42).*STATES(:,12)+ CONSTANTS(:,95).*STATES(:,15);
ALGEBRAIC(:,62) = 1.00000./(1.00000+CONSTANTS(:,15)./ALGEBRAIC(:,48));
ALGEBRAIC(:,63) =  CONSTANTS(:,43).*(STATES(:,1) - ALGEBRAIC(:,57)).*power(STATES(:,11), 3.00000).*( (1.00000 - ALGEBRAIC(:,62)).*ALGEBRAIC(:,60).*STATES(:,14)+ ALGEBRAIC(:,62).*ALGEBRAIC(:,61).*STATES(:,16));
ALGEBRAIC(:,64) = 1.00000./(1.00000+CONSTANTS(:,15)./ALGEBRAIC(:,48));
ALGEBRAIC(:,65) =  CONSTANTS(:,97).*(STATES(:,1) - ALGEBRAIC(:,57)).*STATES(:,17).*( (1.00000 - ALGEBRAIC(:,64)).*STATES(:,18)+ ALGEBRAIC(:,64).*STATES(:,19));
ALGEBRAIC(:,130) = 1.00000./(1.00000+power(CONSTANTS(:,64)./STATES(:,10), 2.00000));
ALGEBRAIC(:,103) = exp(( CONSTANTS(:,62).*STATES(:,1).*CONSTANTS(:,7))./( CONSTANTS(:,5).*CONSTANTS(:,6)));
ALGEBRAIC(:,110) = 1.00000+ (CONSTANTS(:,2)./CONSTANTS(:,55)).*(1.00000+1.00000./ALGEBRAIC(:,103));
ALGEBRAIC(:,111) = CONSTANTS(:,2)./( CONSTANTS(:,55).*ALGEBRAIC(:,103).*ALGEBRAIC(:,110));
ALGEBRAIC(:,114) =  ALGEBRAIC(:,111).*CONSTANTS(:,59);
ALGEBRAIC(:,104) = 1.00000+ (STATES(:,4)./CONSTANTS(:,55)).*(1.00000+ALGEBRAIC(:,103));
ALGEBRAIC(:,105) = ( STATES(:,4).*ALGEBRAIC(:,103))./( CONSTANTS(:,55).*ALGEBRAIC(:,104));
ALGEBRAIC(:,117) =  ALGEBRAIC(:,105).*CONSTANTS(:,59);
ALGEBRAIC(:,107) = 1.00000+ (STATES(:,4)./CONSTANTS(:,53)).*(1.00000+STATES(:,4)./CONSTANTS(:,54));
ALGEBRAIC(:,108) = ( STATES(:,4).*STATES(:,4))./( ALGEBRAIC(:,107).*CONSTANTS(:,53).*CONSTANTS(:,54));
ALGEBRAIC(:,120) =  ALGEBRAIC(:,108).*ALGEBRAIC(:,105).*CONSTANTS(:,57);
ALGEBRAIC(:,121) =  ALGEBRAIC(:,111).*CONSTANTS(:,124).*CONSTANTS(:,57);
ALGEBRAIC(:,112) = 1.00000./ALGEBRAIC(:,110);
ALGEBRAIC(:,113) =  ALGEBRAIC(:,112).*CONSTANTS(:,58);
ALGEBRAIC(:,115) = ALGEBRAIC(:,113)+ALGEBRAIC(:,114);
ALGEBRAIC(:,102) = exp(( CONSTANTS(:,63).*STATES(:,1).*CONSTANTS(:,7))./( CONSTANTS(:,5).*CONSTANTS(:,6)));
ALGEBRAIC(:,106) = 1.00000./ALGEBRAIC(:,104);
ALGEBRAIC(:,116) = ( ALGEBRAIC(:,106).*CONSTANTS(:,58))./ALGEBRAIC(:,102);
ALGEBRAIC(:,118) = ALGEBRAIC(:,116)+ALGEBRAIC(:,117);
ALGEBRAIC(:,109) = 1.00000./ALGEBRAIC(:,107);
ALGEBRAIC(:,119) =  ALGEBRAIC(:,109).*STATES(:,10).*CONSTANTS(:,60);
ALGEBRAIC(:,122) =  CONSTANTS(:,127).*ALGEBRAIC(:,118).*(ALGEBRAIC(:,120)+ALGEBRAIC(:,119))+ CONSTANTS(:,128).*ALGEBRAIC(:,120).*(CONSTANTS(:,127)+ALGEBRAIC(:,115));
ALGEBRAIC(:,123) =  CONSTANTS(:,126).*ALGEBRAIC(:,120).*(ALGEBRAIC(:,118)+CONSTANTS(:,128))+ ALGEBRAIC(:,118).*ALGEBRAIC(:,119).*(CONSTANTS(:,126)+ALGEBRAIC(:,121));
ALGEBRAIC(:,124) =  CONSTANTS(:,126).*ALGEBRAIC(:,115).*(ALGEBRAIC(:,120)+ALGEBRAIC(:,119))+ ALGEBRAIC(:,121).*ALGEBRAIC(:,119).*(CONSTANTS(:,127)+ALGEBRAIC(:,115));
ALGEBRAIC(:,125) =  CONSTANTS(:,127).*ALGEBRAIC(:,121).*(ALGEBRAIC(:,118)+CONSTANTS(:,128))+ ALGEBRAIC(:,115).*CONSTANTS(:,128).*(CONSTANTS(:,126)+ALGEBRAIC(:,121));
ALGEBRAIC(:,126) = ALGEBRAIC(:,122)./(ALGEBRAIC(:,122)+ALGEBRAIC(:,123)+ALGEBRAIC(:,124)+ALGEBRAIC(:,125));
ALGEBRAIC(:,127) = ALGEBRAIC(:,123)./(ALGEBRAIC(:,122)+ALGEBRAIC(:,123)+ALGEBRAIC(:,124)+ALGEBRAIC(:,125));
ALGEBRAIC(:,128) = ALGEBRAIC(:,124)./(ALGEBRAIC(:,122)+ALGEBRAIC(:,123)+ALGEBRAIC(:,124)+ALGEBRAIC(:,125));
ALGEBRAIC(:,129) = ALGEBRAIC(:,125)./(ALGEBRAIC(:,122)+ALGEBRAIC(:,123)+ALGEBRAIC(:,124)+ALGEBRAIC(:,125));
ALGEBRAIC(:,131) = ( 3.00000.*( ALGEBRAIC(:,129).*ALGEBRAIC(:,120) -  ALGEBRAIC(:,126).*ALGEBRAIC(:,121))+ ALGEBRAIC(:,128).*ALGEBRAIC(:,117)) -  ALGEBRAIC(:,127).*ALGEBRAIC(:,114);
ALGEBRAIC(:,132) =  ALGEBRAIC(:,127).*CONSTANTS(:,127) -  ALGEBRAIC(:,126).*CONSTANTS(:,126);
ALGEBRAIC(:,133) =  0.800000.*CONSTANTS(:,129).*ALGEBRAIC(:,130).*( CONSTANTS(:,8).*ALGEBRAIC(:,131)+ CONSTANTS(:,9).*ALGEBRAIC(:,132));
ALGEBRAIC(:,185) = ( CONSTANTS(:,89).*ALGEBRAIC(:,30).*( STATES(:,4).*exp(ALGEBRAIC(:,40)) - CONSTANTS(:,2)))./(exp(ALGEBRAIC(:,40)) - 1.00000);
ALGEBRAIC(:,188) = (STATES(:,5) - STATES(:,4))./2.00000;
ALGEBRAIC(:,79) = ( 1.00000.*ALGEBRAIC(:,30).*( 0.750000.*STATES(:,5).*exp( 1.00000.*ALGEBRAIC(:,40)) -  0.750000.*CONSTANTS(:,2)))./(exp( 1.00000.*ALGEBRAIC(:,40)) - 1.00000);
ALGEBRAIC(:,83) =  (1.00000 - ALGEBRAIC(:,81)).*CONSTANTS(:,112).*ALGEBRAIC(:,79).*STATES(:,26).*( ALGEBRAIC(:,72).*(1.00000 - STATES(:,34))+ STATES(:,31).*ALGEBRAIC(:,75).*STATES(:,34))+ ALGEBRAIC(:,81).*CONSTANTS(:,116).*ALGEBRAIC(:,79).*STATES(:,26).*( ALGEBRAIC(:,76).*(1.00000 - STATES(:,34))+ STATES(:,31).*ALGEBRAIC(:,77).*STATES(:,34));
ALGEBRAIC(:,160) = 1.00000./(1.00000+power(CONSTANTS(:,64)./STATES(:,3), 2.00000));
ALGEBRAIC(:,140) = 1.00000+ (CONSTANTS(:,2)./CONSTANTS(:,55)).*(1.00000+1.00000./ALGEBRAIC(:,103));
ALGEBRAIC(:,141) = CONSTANTS(:,2)./( CONSTANTS(:,55).*ALGEBRAIC(:,103).*ALGEBRAIC(:,140));
ALGEBRAIC(:,144) =  ALGEBRAIC(:,141).*CONSTANTS(:,59);
ALGEBRAIC(:,134) = 1.00000+ (STATES(:,5)./CONSTANTS(:,55)).*(1.00000+ALGEBRAIC(:,103));
ALGEBRAIC(:,135) = ( STATES(:,5).*ALGEBRAIC(:,103))./( CONSTANTS(:,55).*ALGEBRAIC(:,134));
ALGEBRAIC(:,147) =  ALGEBRAIC(:,135).*CONSTANTS(:,59);
ALGEBRAIC(:,137) = 1.00000+ (STATES(:,5)./CONSTANTS(:,53)).*(1.00000+STATES(:,5)./CONSTANTS(:,54));
ALGEBRAIC(:,138) = ( STATES(:,5).*STATES(:,5))./( ALGEBRAIC(:,137).*CONSTANTS(:,53).*CONSTANTS(:,54));
ALGEBRAIC(:,150) =  ALGEBRAIC(:,138).*ALGEBRAIC(:,135).*CONSTANTS(:,57);
ALGEBRAIC(:,151) =  ALGEBRAIC(:,141).*CONSTANTS(:,131).*CONSTANTS(:,57);
ALGEBRAIC(:,142) = 1.00000./ALGEBRAIC(:,140);
ALGEBRAIC(:,143) =  ALGEBRAIC(:,142).*CONSTANTS(:,58);
ALGEBRAIC(:,145) = ALGEBRAIC(:,143)+ALGEBRAIC(:,144);
ALGEBRAIC(:,136) = 1.00000./ALGEBRAIC(:,134);
ALGEBRAIC(:,146) = ( ALGEBRAIC(:,136).*CONSTANTS(:,58))./ALGEBRAIC(:,102);
ALGEBRAIC(:,148) = ALGEBRAIC(:,146)+ALGEBRAIC(:,147);
ALGEBRAIC(:,139) = 1.00000./ALGEBRAIC(:,137);
ALGEBRAIC(:,149) =  ALGEBRAIC(:,139).*STATES(:,3).*CONSTANTS(:,60);
ALGEBRAIC(:,152) =  CONSTANTS(:,134).*ALGEBRAIC(:,148).*(ALGEBRAIC(:,150)+ALGEBRAIC(:,149))+ CONSTANTS(:,135).*ALGEBRAIC(:,150).*(CONSTANTS(:,134)+ALGEBRAIC(:,145));
ALGEBRAIC(:,153) =  CONSTANTS(:,133).*ALGEBRAIC(:,150).*(ALGEBRAIC(:,148)+CONSTANTS(:,135))+ ALGEBRAIC(:,148).*ALGEBRAIC(:,149).*(CONSTANTS(:,133)+ALGEBRAIC(:,151));
ALGEBRAIC(:,154) =  CONSTANTS(:,133).*ALGEBRAIC(:,145).*(ALGEBRAIC(:,150)+ALGEBRAIC(:,149))+ ALGEBRAIC(:,151).*ALGEBRAIC(:,149).*(CONSTANTS(:,134)+ALGEBRAIC(:,145));
ALGEBRAIC(:,155) =  CONSTANTS(:,134).*ALGEBRAIC(:,151).*(ALGEBRAIC(:,148)+CONSTANTS(:,135))+ ALGEBRAIC(:,145).*CONSTANTS(:,135).*(CONSTANTS(:,133)+ALGEBRAIC(:,151));
ALGEBRAIC(:,156) = ALGEBRAIC(:,152)./(ALGEBRAIC(:,152)+ALGEBRAIC(:,153)+ALGEBRAIC(:,154)+ALGEBRAIC(:,155));
ALGEBRAIC(:,157) = ALGEBRAIC(:,153)./(ALGEBRAIC(:,152)+ALGEBRAIC(:,153)+ALGEBRAIC(:,154)+ALGEBRAIC(:,155));
ALGEBRAIC(:,158) = ALGEBRAIC(:,154)./(ALGEBRAIC(:,152)+ALGEBRAIC(:,153)+ALGEBRAIC(:,154)+ALGEBRAIC(:,155));
ALGEBRAIC(:,159) = ALGEBRAIC(:,155)./(ALGEBRAIC(:,152)+ALGEBRAIC(:,153)+ALGEBRAIC(:,154)+ALGEBRAIC(:,155));
ALGEBRAIC(:,161) = ( 3.00000.*( ALGEBRAIC(:,159).*ALGEBRAIC(:,150) -  ALGEBRAIC(:,156).*ALGEBRAIC(:,151))+ ALGEBRAIC(:,158).*ALGEBRAIC(:,147)) -  ALGEBRAIC(:,157).*ALGEBRAIC(:,144);
ALGEBRAIC(:,162) =  ALGEBRAIC(:,157).*CONSTANTS(:,134) -  ALGEBRAIC(:,156).*CONSTANTS(:,133);
ALGEBRAIC(:,163) =  0.200000.*CONSTANTS(:,129).*ALGEBRAIC(:,160).*( CONSTANTS(:,8).*ALGEBRAIC(:,161)+ CONSTANTS(:,9).*ALGEBRAIC(:,162));
ALGEBRAIC(:,189) = ( CONSTANTS(:,91).*STATES(:,10))./(CONSTANTS(:,92)+STATES(:,10));
ALGEBRAIC(:,187) = ( CONSTANTS(:,90).*4.00000.*ALGEBRAIC(:,30).*( STATES(:,10).*exp( 2.00000.*ALGEBRAIC(:,40)) -  0.341000.*CONSTANTS(:,3)))./(exp( 2.00000.*ALGEBRAIC(:,40)) - 1.00000);
ALGEBRAIC(:,190) = (STATES(:,3) - STATES(:,10))./0.200000;
ALGEBRAIC(:,191) = 1.00000./(1.00000+CONSTANTS(:,15)./ALGEBRAIC(:,48));
ALGEBRAIC(:,192) =  (1.00000 - ALGEBRAIC(:,191)).*STATES(:,40)+ ALGEBRAIC(:,191).*STATES(:,41);
ALGEBRAIC(:,52) = 1.00000./(1.00000+( CONSTANTS(:,24).*CONSTANTS(:,25))./power(CONSTANTS(:,25)+STATES(:,3), 2.00000)+( CONSTANTS(:,26).*CONSTANTS(:,27))./power(CONSTANTS(:,27)+STATES(:,3), 2.00000));
ALGEBRAIC(:,193) = ( CONSTANTS(:,109).*0.00437500.*STATES(:,10))./(STATES(:,10)+0.000920000);
ALGEBRAIC(:,194) = ( CONSTANTS(:,109).*2.75000.*0.00437500.*STATES(:,10))./((STATES(:,10)+0.000920000) - 0.000170000);
ALGEBRAIC(:,195) = 1.00000./(1.00000+CONSTANTS(:,15)./ALGEBRAIC(:,48));
ALGEBRAIC(:,196) = ( 0.00393750.*STATES(:,8))./15.0000;
ALGEBRAIC(:,197) = ( (1.00000 - ALGEBRAIC(:,195)).*ALGEBRAIC(:,193)+ ALGEBRAIC(:,195).*ALGEBRAIC(:,194)) - ALGEBRAIC(:,196);
ALGEBRAIC(:,50) = 1.00000./(1.00000+( CONSTANTS(:,94).*CONSTANTS(:,21))./power(CONSTANTS(:,21)+STATES(:,10), 2.00000)+( CONSTANTS(:,22).*CONSTANTS(:,23))./power(CONSTANTS(:,23)+STATES(:,10), 2.00000));
ALGEBRAIC(:,198) = (STATES(:,8) - STATES(:,9))./100.000;
ALGEBRAIC(:,54) = 1.00000./(1.00000+( CONSTANTS(:,28).*CONSTANTS(:,29))./power(CONSTANTS(:,29)+STATES(:,9), 2.00000));
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
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 An encoding of the human ORd model by Steve Neiderer at changeset 2593df010620.
This exposure was expired.
Collaboration
To begin collaborating on this work, please use your git client and issue this command: