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 =93; end % There are a total of 24 entries in each of the rate and state variable arrays. % There are a total of 44 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('t in component environment (second)'); LEGEND_CONSTANTS(:,1) = strpad('R in component environment (J_per_K_per_mol)'); LEGEND_CONSTANTS(:,2) = strpad('T in component environment (kelvin)'); LEGEND_CONSTANTS(:,3) = strpad('F in component environment (C_per_mol)'); LEGEND_CONSTANTS(:,4) = strpad('C_m in component environment (fF)'); LEGEND_STATES(:,1) = strpad('q_K_o in component environment (fmol)'); LEGEND_STATES(:,2) = strpad('q_K_i in component environment (fmol)'); LEGEND_STATES(:,3) = strpad('q_Na_o in component environment (fmol)'); LEGEND_STATES(:,4) = strpad('q_Na_i in component environment (fmol)'); LEGEND_STATES(:,5) = strpad('q_H_i in component environment (fmol)'); LEGEND_STATES(:,6) = strpad('q_MgADP in component environment (fmol)'); LEGEND_STATES(:,7) = strpad('q_MgATP in component environment (fmol)'); LEGEND_STATES(:,8) = strpad('q_Pi in component environment (fmol)'); LEGEND_STATES(:,9) = strpad('q_P7 in component environment (fmol)'); LEGEND_STATES(:,10) = strpad('q_P14 in component environment (fmol)'); LEGEND_STATES(:,11) = strpad('q_P15 in component environment (fmol)'); LEGEND_STATES(:,12) = strpad('q_P1 in component environment (fmol)'); LEGEND_STATES(:,13) = strpad('q_P2 in component environment (fmol)'); LEGEND_STATES(:,14) = strpad('q_P3 in component environment (fmol)'); LEGEND_STATES(:,15) = strpad('q_P4 in component environment (fmol)'); LEGEND_STATES(:,16) = strpad('q_P5 in component environment (fmol)'); LEGEND_STATES(:,17) = strpad('q_P6 in component environment (fmol)'); LEGEND_STATES(:,18) = strpad('q_P10 in component environment (fmol)'); LEGEND_STATES(:,19) = strpad('q_P11 in component environment (fmol)'); LEGEND_STATES(:,20) = strpad('q_P12 in component environment (fmol)'); LEGEND_STATES(:,21) = strpad('q_P13 in component environment (fmol)'); LEGEND_STATES(:,22) = strpad('q_P8 in component environment (fmol)'); LEGEND_STATES(:,23) = strpad('q_P9 in component environment (fmol)'); LEGEND_ALGEBRAIC(:,55) = strpad('v_K_o_NaK in component NaK (fmol_per_sec)'); LEGEND_ALGEBRAIC(:,48) = strpad('v_K_i_NaK in component NaK (fmol_per_sec)'); LEGEND_ALGEBRAIC(:,91) = strpad('v_Na_o_NaK in component NaK (fmol_per_sec)'); LEGEND_ALGEBRAIC(:,70) = strpad('v_Na_i_NaK in component NaK (fmol_per_sec)'); LEGEND_ALGEBRAIC(:,62) = strpad('v_H_NaK in component NaK (fmol_per_sec)'); LEGEND_ALGEBRAIC(:,78) = strpad('v_MgADP_NaK in component NaK (fmol_per_sec)'); LEGEND_ALGEBRAIC(:,71) = strpad('v_MgATP_NaK in component NaK (fmol_per_sec)'); LEGEND_ALGEBRAIC(:,63) = strpad('v_Pi_NaK in component NaK (fmol_per_sec)'); LEGEND_STATES(:,24) = strpad('q_mem in component environment (fC)'); LEGEND_ALGEBRAIC(:,87) = strpad('I_mem_NaK in component NaK (fA)'); LEGEND_CONSTANTS(:,5) = strpad('kappa_1_NaK in component NaK_parameters (fmol_per_sec)'); LEGEND_CONSTANTS(:,6) = strpad('kappa_2_NaK in component NaK_parameters (fmol_per_sec)'); LEGEND_CONSTANTS(:,7) = strpad('kappa_3_NaK in component NaK_parameters (fmol_per_sec)'); LEGEND_CONSTANTS(:,8) = strpad('kappa_4_NaK in component NaK_parameters (fmol_per_sec)'); LEGEND_CONSTANTS(:,9) = strpad('kappa_5_NaK in component NaK_parameters (fmol_per_sec)'); LEGEND_CONSTANTS(:,10) = strpad('kappa_6_NaK in component NaK_parameters (fmol_per_sec)'); LEGEND_CONSTANTS(:,11) = strpad('kappa_7_NaK in component NaK_parameters (fmol_per_sec)'); LEGEND_CONSTANTS(:,12) = strpad('kappa_8_NaK in component NaK_parameters (fmol_per_sec)'); LEGEND_CONSTANTS(:,13) = strpad('kappa_9_NaK in component NaK_parameters (fmol_per_sec)'); LEGEND_CONSTANTS(:,14) = strpad('kappa_10_NaK in component NaK_parameters (fmol_per_sec)'); LEGEND_CONSTANTS(:,15) = strpad('kappa_11_NaK in component NaK_parameters (fmol_per_sec)'); LEGEND_CONSTANTS(:,16) = strpad('kappa_12_NaK in component NaK_parameters (fmol_per_sec)'); LEGEND_CONSTANTS(:,17) = strpad('kappa_13_NaK in component NaK_parameters (fmol_per_sec)'); LEGEND_CONSTANTS(:,18) = strpad('kappa_14_NaK in component NaK_parameters (fmol_per_sec)'); LEGEND_CONSTANTS(:,19) = strpad('kappa_15_NaK in component NaK_parameters (fmol_per_sec)'); LEGEND_CONSTANTS(:,20) = strpad('K_1_NaK in component NaK_parameters (per_fmol)'); LEGEND_CONSTANTS(:,21) = strpad('K_2_NaK in component NaK_parameters (per_fmol)'); LEGEND_CONSTANTS(:,22) = strpad('K_3_NaK in component NaK_parameters (per_fmol)'); LEGEND_CONSTANTS(:,23) = strpad('K_4_NaK in component NaK_parameters (per_fmol)'); LEGEND_CONSTANTS(:,24) = strpad('K_5_NaK in component NaK_parameters (per_fmol)'); LEGEND_CONSTANTS(:,25) = strpad('K_6_NaK in component NaK_parameters (per_fmol)'); LEGEND_CONSTANTS(:,26) = strpad('K_7_NaK in component NaK_parameters (per_fmol)'); LEGEND_CONSTANTS(:,27) = strpad('K_8_NaK in component NaK_parameters (per_fmol)'); LEGEND_CONSTANTS(:,28) = strpad('K_9_NaK in component NaK_parameters (per_fmol)'); LEGEND_CONSTANTS(:,29) = strpad('K_10_NaK in component NaK_parameters (per_fmol)'); LEGEND_CONSTANTS(:,30) = strpad('K_11_NaK in component NaK_parameters (per_fmol)'); LEGEND_CONSTANTS(:,31) = strpad('K_12_NaK in component NaK_parameters (per_fmol)'); LEGEND_CONSTANTS(:,32) = strpad('K_13_NaK in component NaK_parameters (per_fmol)'); LEGEND_CONSTANTS(:,33) = strpad('K_14_NaK in component NaK_parameters (per_fmol)'); LEGEND_CONSTANTS(:,34) = strpad('K_15_NaK in component NaK_parameters (per_fmol)'); LEGEND_CONSTANTS(:,35) = strpad('K_K_i in component NaK_parameters (per_fmol)'); LEGEND_CONSTANTS(:,36) = strpad('K_K_o in component NaK_parameters (per_fmol)'); LEGEND_CONSTANTS(:,37) = strpad('K_Na_i in component NaK_parameters (per_fmol)'); LEGEND_CONSTANTS(:,38) = strpad('K_Na_o in component NaK_parameters (per_fmol)'); LEGEND_CONSTANTS(:,39) = strpad('K_MgATP in component NaK_parameters (per_fmol)'); LEGEND_CONSTANTS(:,40) = strpad('K_MgADP in component NaK_parameters (per_fmol)'); LEGEND_CONSTANTS(:,41) = strpad('K_Pi in component NaK_parameters (per_fmol)'); LEGEND_CONSTANTS(:,42) = strpad('K_H in component NaK_parameters (per_fmol)'); LEGEND_CONSTANTS(:,43) = strpad('zF_5 in component NaK_parameters (C_per_mol)'); LEGEND_CONSTANTS(:,44) = strpad('zF_8 in component NaK_parameters (C_per_mol)'); LEGEND_ALGEBRAIC(:,3) = strpad('mu_K_o in component NaK (J_per_mol)'); LEGEND_ALGEBRAIC(:,4) = strpad('mu_K_i in component NaK (J_per_mol)'); LEGEND_ALGEBRAIC(:,7) = strpad('mu_Na_o in component NaK (J_per_mol)'); LEGEND_ALGEBRAIC(:,8) = strpad('mu_Na_i in component NaK (J_per_mol)'); LEGEND_ALGEBRAIC(:,2) = strpad('mu_H in component NaK (J_per_mol)'); LEGEND_ALGEBRAIC(:,5) = strpad('mu_MgADP in component NaK (J_per_mol)'); LEGEND_ALGEBRAIC(:,6) = strpad('mu_MgATP in component NaK (J_per_mol)'); LEGEND_ALGEBRAIC(:,21) = strpad('mu_P7 in component NaK (J_per_mol)'); LEGEND_ALGEBRAIC(:,24) = strpad('mu_Pi in component NaK (J_per_mol)'); LEGEND_ALGEBRAIC(:,14) = strpad('mu_P14 in component NaK (J_per_mol)'); LEGEND_ALGEBRAIC(:,15) = strpad('mu_P15 in component NaK (J_per_mol)'); LEGEND_ALGEBRAIC(:,9) = strpad('mu_P1 in component NaK (J_per_mol)'); LEGEND_ALGEBRAIC(:,16) = strpad('mu_P2 in component NaK (J_per_mol)'); LEGEND_ALGEBRAIC(:,17) = strpad('mu_P3 in component NaK (J_per_mol)'); LEGEND_ALGEBRAIC(:,18) = strpad('mu_P4 in component NaK (J_per_mol)'); LEGEND_ALGEBRAIC(:,19) = strpad('mu_P5 in component NaK (J_per_mol)'); LEGEND_ALGEBRAIC(:,20) = strpad('mu_P6 in component NaK (J_per_mol)'); LEGEND_ALGEBRAIC(:,10) = strpad('mu_P10 in component NaK (J_per_mol)'); LEGEND_ALGEBRAIC(:,11) = strpad('mu_P11 in component NaK (J_per_mol)'); LEGEND_ALGEBRAIC(:,12) = strpad('mu_P12 in component NaK (J_per_mol)'); LEGEND_ALGEBRAIC(:,13) = strpad('mu_P13 in component NaK (J_per_mol)'); LEGEND_ALGEBRAIC(:,22) = strpad('mu_P8 in component NaK (J_per_mol)'); LEGEND_ALGEBRAIC(:,23) = strpad('mu_P9 in component NaK (J_per_mol)'); LEGEND_ALGEBRAIC(:,72) = strpad('v_P14 in component NaK (fmol_per_sec)'); LEGEND_ALGEBRAIC(:,80) = strpad('v_P15 in component NaK (fmol_per_sec)'); LEGEND_ALGEBRAIC(:,81) = strpad('v_P1 in component NaK (fmol_per_sec)'); LEGEND_ALGEBRAIC(:,50) = strpad('v_P2 in component NaK (fmol_per_sec)'); LEGEND_ALGEBRAIC(:,57) = strpad('v_P3 in component NaK (fmol_per_sec)'); LEGEND_ALGEBRAIC(:,64) = strpad('v_P4 in component NaK (fmol_per_sec)'); LEGEND_ALGEBRAIC(:,73) = strpad('v_P5 in component NaK (fmol_per_sec)'); LEGEND_ALGEBRAIC(:,82) = strpad('v_P6 in component NaK (fmol_per_sec)'); LEGEND_ALGEBRAIC(:,92) = strpad('v_P10 in component NaK (fmol_per_sec)'); LEGEND_ALGEBRAIC(:,51) = strpad('v_P11 in component NaK (fmol_per_sec)'); LEGEND_ALGEBRAIC(:,58) = strpad('v_P12 in component NaK (fmol_per_sec)'); LEGEND_ALGEBRAIC(:,65) = strpad('v_P13 in component NaK (fmol_per_sec)'); LEGEND_ALGEBRAIC(:,85) = strpad('v_P7 in component NaK (fmol_per_sec)'); LEGEND_ALGEBRAIC(:,88) = strpad('v_P8 in component NaK (fmol_per_sec)'); LEGEND_ALGEBRAIC(:,93) = strpad('v_P9 in component NaK (fmol_per_sec)'); LEGEND_ALGEBRAIC(:,25) = strpad('Af_R1 in component NaK (J_per_mol)'); LEGEND_ALGEBRAIC(:,40) = strpad('Ar_R1 in component NaK (J_per_mol)'); LEGEND_ALGEBRAIC(:,41) = strpad('v_R1 in component NaK (fmol_per_sec)'); LEGEND_ALGEBRAIC(:,26) = strpad('Af_R10 in component NaK (J_per_mol)'); LEGEND_ALGEBRAIC(:,42) = strpad('Ar_R10 in component NaK (J_per_mol)'); LEGEND_ALGEBRAIC(:,43) = strpad('v_R10 in component NaK (fmol_per_sec)'); LEGEND_ALGEBRAIC(:,27) = strpad('Af_R11 in component NaK (J_per_mol)'); LEGEND_ALGEBRAIC(:,45) = strpad('Ar_R11 in component NaK (J_per_mol)'); LEGEND_ALGEBRAIC(:,47) = strpad('v_R11 in component NaK (fmol_per_sec)'); LEGEND_ALGEBRAIC(:,28) = strpad('Af_R12 in component NaK (J_per_mol)'); LEGEND_ALGEBRAIC(:,52) = strpad('Ar_R12 in component NaK (J_per_mol)'); LEGEND_ALGEBRAIC(:,54) = strpad('v_R12 in component NaK (fmol_per_sec)'); LEGEND_ALGEBRAIC(:,29) = strpad('Af_R13 in component NaK (J_per_mol)'); LEGEND_ALGEBRAIC(:,59) = strpad('Ar_R13 in component NaK (J_per_mol)'); LEGEND_ALGEBRAIC(:,60) = strpad('v_R13 in component NaK (fmol_per_sec)'); LEGEND_ALGEBRAIC(:,30) = strpad('Af_R14 in component NaK (J_per_mol)'); LEGEND_ALGEBRAIC(:,66) = strpad('Ar_R14 in component NaK (J_per_mol)'); LEGEND_ALGEBRAIC(:,68) = strpad('v_R14 in component NaK (fmol_per_sec)'); LEGEND_ALGEBRAIC(:,31) = strpad('Af_R15 in component NaK (J_per_mol)'); LEGEND_ALGEBRAIC(:,74) = strpad('Ar_R15 in component NaK (J_per_mol)'); LEGEND_ALGEBRAIC(:,76) = strpad('v_R15 in component NaK (fmol_per_sec)'); LEGEND_ALGEBRAIC(:,32) = strpad('Af_R2 in component NaK (J_per_mol)'); LEGEND_ALGEBRAIC(:,44) = strpad('Ar_R2 in component NaK (J_per_mol)'); LEGEND_ALGEBRAIC(:,46) = strpad('v_R2 in component NaK (fmol_per_sec)'); LEGEND_ALGEBRAIC(:,33) = strpad('Af_R3 in component NaK (J_per_mol)'); LEGEND_ALGEBRAIC(:,49) = strpad('Ar_R3 in component NaK (J_per_mol)'); LEGEND_ALGEBRAIC(:,53) = strpad('v_R3 in component NaK (fmol_per_sec)'); LEGEND_ALGEBRAIC(:,34) = strpad('Af_R4 in component NaK (J_per_mol)'); LEGEND_ALGEBRAIC(:,56) = strpad('Ar_R4 in component NaK (J_per_mol)'); LEGEND_ALGEBRAIC(:,61) = strpad('v_R4 in component NaK (fmol_per_sec)'); LEGEND_ALGEBRAIC(:,35) = strpad('Af_R5 in component NaK (J_per_mol)'); LEGEND_ALGEBRAIC(:,67) = strpad('Ar_R5 in component NaK (J_per_mol)'); LEGEND_ALGEBRAIC(:,69) = strpad('v_R5 in component NaK (fmol_per_sec)'); LEGEND_ALGEBRAIC(:,36) = strpad('Af_R6 in component NaK (J_per_mol)'); LEGEND_ALGEBRAIC(:,75) = strpad('Ar_R6 in component NaK (J_per_mol)'); LEGEND_ALGEBRAIC(:,77) = strpad('v_R6 in component NaK (fmol_per_sec)'); LEGEND_ALGEBRAIC(:,37) = strpad('Af_R7 in component NaK (J_per_mol)'); LEGEND_ALGEBRAIC(:,79) = strpad('Ar_R7 in component NaK (J_per_mol)'); LEGEND_ALGEBRAIC(:,83) = strpad('v_R7 in component NaK (fmol_per_sec)'); LEGEND_ALGEBRAIC(:,38) = strpad('Af_R8 in component NaK (J_per_mol)'); LEGEND_ALGEBRAIC(:,84) = strpad('Ar_R8 in component NaK (J_per_mol)'); LEGEND_ALGEBRAIC(:,86) = strpad('v_R8 in component NaK (fmol_per_sec)'); LEGEND_ALGEBRAIC(:,39) = strpad('Af_R9 in component NaK (J_per_mol)'); LEGEND_ALGEBRAIC(:,89) = strpad('Ar_R9 in component NaK (J_per_mol)'); LEGEND_ALGEBRAIC(:,90) = strpad('v_R9 in component NaK (fmol_per_sec)'); LEGEND_ALGEBRAIC(:,1) = strpad('V_mem in component NaK (volt)'); LEGEND_RATES(:,1) = strpad('d/dt q_K_o in component environment (fmol)'); LEGEND_RATES(:,2) = strpad('d/dt q_K_i in component environment (fmol)'); LEGEND_RATES(:,3) = strpad('d/dt q_Na_o in component environment (fmol)'); LEGEND_RATES(:,4) = strpad('d/dt q_Na_i in component environment (fmol)'); LEGEND_RATES(:,5) = strpad('d/dt q_H_i in component environment (fmol)'); LEGEND_RATES(:,6) = strpad('d/dt q_MgADP in component environment (fmol)'); LEGEND_RATES(:,7) = strpad('d/dt q_MgATP in component environment (fmol)'); LEGEND_RATES(:,8) = strpad('d/dt q_Pi in component environment (fmol)'); LEGEND_RATES(:,24) = strpad('d/dt q_mem in component environment (fC)'); LEGEND_RATES(:,9) = strpad('d/dt q_P7 in component environment (fmol)'); LEGEND_RATES(:,10) = strpad('d/dt q_P14 in component environment (fmol)'); LEGEND_RATES(:,11) = strpad('d/dt q_P15 in component environment (fmol)'); LEGEND_RATES(:,12) = strpad('d/dt q_P1 in component environment (fmol)'); LEGEND_RATES(:,13) = strpad('d/dt q_P2 in component environment (fmol)'); LEGEND_RATES(:,14) = strpad('d/dt q_P3 in component environment (fmol)'); LEGEND_RATES(:,15) = strpad('d/dt q_P4 in component environment (fmol)'); LEGEND_RATES(:,16) = strpad('d/dt q_P5 in component environment (fmol)'); LEGEND_RATES(:,17) = strpad('d/dt q_P6 in component environment (fmol)'); LEGEND_RATES(:,18) = strpad('d/dt q_P10 in component environment (fmol)'); LEGEND_RATES(:,19) = strpad('d/dt q_P11 in component environment (fmol)'); LEGEND_RATES(:,20) = strpad('d/dt q_P12 in component environment (fmol)'); LEGEND_RATES(:,21) = strpad('d/dt q_P13 in component environment (fmol)'); LEGEND_RATES(:,22) = strpad('d/dt q_P8 in component environment (fmol)'); LEGEND_RATES(:,23) = strpad('d/dt q_P9 in component environment (fmol)'); 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) = 8.314; CONSTANTS(:,2) = 310; CONSTANTS(:,3) = 96485; CONSTANTS(:,4) = 153400; STATES(:,1) = 27.9828; STATES(:,2) = 5510; STATES(:,3) = 725.48; STATES(:,4) = 380; STATES(:,5) = 0.0030534; STATES(:,6) = 1.33; STATES(:,7) = 264.1; STATES(:,8) = 15.0898; STATES(:,9) = 0.001126432; STATES(:,10) = 0.001126432; STATES(:,11) = 0.001126432; STATES(:,12) = 0.001126432; STATES(:,13) = 0.001126432; STATES(:,14) = 0.001126432; STATES(:,15) = 0.001126432; STATES(:,16) = 0.001126432; STATES(:,17) = 0.001126432; STATES(:,18) = 0.001126432; STATES(:,19) = 0.001126432; STATES(:,20) = 0.001126432; STATES(:,21) = 0.001126432; STATES(:,22) = 0.001126432; STATES(:,23) = 0.001126432; STATES(:,24) = -13039; CONSTANTS(:,5) = 28701.2; CONSTANTS(:,6) = 1.02749e+06; CONSTANTS(:,7) = 36989.9; CONSTANTS(:,8) = 110769; CONSTANTS(:,9) = 143.043; CONSTANTS(:,10) = 0.203578; CONSTANTS(:,11) = 73.4728; CONSTANTS(:,12) = 70.4896; CONSTANTS(:,13) = 19895.6; CONSTANTS(:,14) = 1.40388e+06; CONSTANTS(:,15) = 7905.94; CONSTANTS(:,16) = 6193.15; CONSTANTS(:,17) = 0.55667; CONSTANTS(:,18) = 6163.37; CONSTANTS(:,19) = 1.34489; CONSTANTS(:,20) = 1.17033e+06; CONSTANTS(:,21) = 8172.83; CONSTANTS(:,22) = 228.295; CONSTANTS(:,23) = 76.2363; CONSTANTS(:,24) = 101.833; CONSTANTS(:,25) = 6990.92; CONSTANTS(:,26) = 157.403; CONSTANTS(:,27) = 494.813; CONSTANTS(:,28) = 1.06726e+06; CONSTANTS(:,29) = 3781.29; CONSTANTS(:,30) = 53.588; CONSTANTS(:,31) = 68.4084; CONSTANTS(:,32) = 349.31; CONSTANTS(:,33) = 105.854; CONSTANTS(:,34) = 22775; CONSTANTS(:,35) = 0.000123928; CONSTANTS(:,36) = 0.455493; CONSTANTS(:,37) = 0.00344241; CONSTANTS(:,38) = 0.00256511; CONSTANTS(:,39) = 0.0445571; CONSTANTS(:,40) = 0.204939; CONSTANTS(:,41) = 2.00757; CONSTANTS(:,42) = 2.00757; CONSTANTS(:,43) = -5301.979; CONSTANTS(:,44) = -91183.021; 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 ALGEBRAIC(:,9) = CONSTANTS(:,1).*CONSTANTS(:,2).*log( CONSTANTS(:,20).*STATES(:,12)); ALGEBRAIC(:,25) = ALGEBRAIC(:,9); ALGEBRAIC(:,4) = CONSTANTS(:,1).*CONSTANTS(:,2).*log( CONSTANTS(:,35).*STATES(:,2)); ALGEBRAIC(:,16) = CONSTANTS(:,1).*CONSTANTS(:,2).*log( CONSTANTS(:,21).*STATES(:,13)); ALGEBRAIC(:,40) = ALGEBRAIC(:,4)+ALGEBRAIC(:,16); ALGEBRAIC(:,41) = CONSTANTS(:,5).*(exp(ALGEBRAIC(:,25)./( CONSTANTS(:,1).*CONSTANTS(:,2))) - exp(ALGEBRAIC(:,40)./( CONSTANTS(:,1).*CONSTANTS(:,2)))); ALGEBRAIC(:,32) = ALGEBRAIC(:,16); ALGEBRAIC(:,17) = CONSTANTS(:,1).*CONSTANTS(:,2).*log( CONSTANTS(:,22).*STATES(:,14)); ALGEBRAIC(:,44) = ALGEBRAIC(:,17)+ALGEBRAIC(:,4); ALGEBRAIC(:,46) = CONSTANTS(:,6).*(exp(ALGEBRAIC(:,32)./( CONSTANTS(:,1).*CONSTANTS(:,2))) - exp(ALGEBRAIC(:,44)./( CONSTANTS(:,1).*CONSTANTS(:,2)))); ALGEBRAIC(:,48) = ALGEBRAIC(:,41)+ALGEBRAIC(:,46); RATES(:,2) = ALGEBRAIC(:,48); ALGEBRAIC(:,50) = - ALGEBRAIC(:,46)+ALGEBRAIC(:,41); RATES(:,13) = ALGEBRAIC(:,50); ALGEBRAIC(:,10) = CONSTANTS(:,1).*CONSTANTS(:,2).*log( CONSTANTS(:,29).*STATES(:,18)); ALGEBRAIC(:,26) = ALGEBRAIC(:,10); ALGEBRAIC(:,7) = CONSTANTS(:,1).*CONSTANTS(:,2).*log( CONSTANTS(:,38).*STATES(:,3)); ALGEBRAIC(:,11) = CONSTANTS(:,1).*CONSTANTS(:,2).*log( CONSTANTS(:,30).*STATES(:,19)); ALGEBRAIC(:,42) = ALGEBRAIC(:,7)+ALGEBRAIC(:,11); ALGEBRAIC(:,43) = CONSTANTS(:,14).*(exp(ALGEBRAIC(:,26)./( CONSTANTS(:,1).*CONSTANTS(:,2))) - exp(ALGEBRAIC(:,42)./( CONSTANTS(:,1).*CONSTANTS(:,2)))); ALGEBRAIC(:,3) = CONSTANTS(:,1).*CONSTANTS(:,2).*log( CONSTANTS(:,36).*STATES(:,1)); ALGEBRAIC(:,27) = ALGEBRAIC(:,11)+ALGEBRAIC(:,3); ALGEBRAIC(:,12) = CONSTANTS(:,1).*CONSTANTS(:,2).*log( CONSTANTS(:,31).*STATES(:,20)); ALGEBRAIC(:,45) = ALGEBRAIC(:,12); ALGEBRAIC(:,47) = CONSTANTS(:,15).*(exp(ALGEBRAIC(:,27)./( CONSTANTS(:,1).*CONSTANTS(:,2))) - exp(ALGEBRAIC(:,45)./( CONSTANTS(:,1).*CONSTANTS(:,2)))); ALGEBRAIC(:,51) = ALGEBRAIC(:,43) - ALGEBRAIC(:,47); RATES(:,19) = ALGEBRAIC(:,51); ALGEBRAIC(:,28) = ALGEBRAIC(:,12)+ALGEBRAIC(:,3); ALGEBRAIC(:,13) = CONSTANTS(:,1).*CONSTANTS(:,2).*log( CONSTANTS(:,32).*STATES(:,21)); ALGEBRAIC(:,52) = ALGEBRAIC(:,13); ALGEBRAIC(:,54) = CONSTANTS(:,16).*(exp(ALGEBRAIC(:,28)./( CONSTANTS(:,1).*CONSTANTS(:,2))) - exp(ALGEBRAIC(:,52)./( CONSTANTS(:,1).*CONSTANTS(:,2)))); ALGEBRAIC(:,55) = - ALGEBRAIC(:,47) - ALGEBRAIC(:,54); RATES(:,1) = ALGEBRAIC(:,55); ALGEBRAIC(:,8) = CONSTANTS(:,1).*CONSTANTS(:,2).*log( CONSTANTS(:,37).*STATES(:,4)); ALGEBRAIC(:,33) = ALGEBRAIC(:,17)+ALGEBRAIC(:,8); ALGEBRAIC(:,18) = CONSTANTS(:,1).*CONSTANTS(:,2).*log( CONSTANTS(:,23).*STATES(:,15)); ALGEBRAIC(:,49) = ALGEBRAIC(:,18); ALGEBRAIC(:,53) = CONSTANTS(:,7).*(exp(ALGEBRAIC(:,33)./( CONSTANTS(:,1).*CONSTANTS(:,2))) - exp(ALGEBRAIC(:,49)./( CONSTANTS(:,1).*CONSTANTS(:,2)))); ALGEBRAIC(:,57) = ALGEBRAIC(:,46) - ALGEBRAIC(:,53); RATES(:,14) = ALGEBRAIC(:,57); ALGEBRAIC(:,58) = - ALGEBRAIC(:,54)+ALGEBRAIC(:,47); RATES(:,20) = ALGEBRAIC(:,58); ALGEBRAIC(:,29) = ALGEBRAIC(:,13); ALGEBRAIC(:,2) = CONSTANTS(:,1).*CONSTANTS(:,2).*log( CONSTANTS(:,42).*STATES(:,5)); ALGEBRAIC(:,24) = CONSTANTS(:,1).*CONSTANTS(:,2).*log( CONSTANTS(:,41).*STATES(:,8)); ALGEBRAIC(:,14) = CONSTANTS(:,1).*CONSTANTS(:,2).*log( CONSTANTS(:,33).*STATES(:,10)); ALGEBRAIC(:,59) = ALGEBRAIC(:,2)+ALGEBRAIC(:,24)+ALGEBRAIC(:,14); ALGEBRAIC(:,60) = CONSTANTS(:,17).*(exp(ALGEBRAIC(:,29)./( CONSTANTS(:,1).*CONSTANTS(:,2))) - exp(ALGEBRAIC(:,59)./( CONSTANTS(:,1).*CONSTANTS(:,2)))); ALGEBRAIC(:,62) = ALGEBRAIC(:,60); RATES(:,5) = ALGEBRAIC(:,62); ALGEBRAIC(:,63) = ALGEBRAIC(:,60); RATES(:,8) = ALGEBRAIC(:,63); ALGEBRAIC(:,34) = ALGEBRAIC(:,18)+ALGEBRAIC(:,8); ALGEBRAIC(:,19) = CONSTANTS(:,1).*CONSTANTS(:,2).*log( CONSTANTS(:,24).*STATES(:,16)); ALGEBRAIC(:,56) = ALGEBRAIC(:,19); ALGEBRAIC(:,61) = CONSTANTS(:,8).*(exp(ALGEBRAIC(:,34)./( CONSTANTS(:,1).*CONSTANTS(:,2))) - exp(ALGEBRAIC(:,56)./( CONSTANTS(:,1).*CONSTANTS(:,2)))); ALGEBRAIC(:,64) = ALGEBRAIC(:,53) - ALGEBRAIC(:,61); RATES(:,15) = ALGEBRAIC(:,64); ALGEBRAIC(:,65) = ALGEBRAIC(:,54) - ALGEBRAIC(:,60); RATES(:,21) = ALGEBRAIC(:,65); ALGEBRAIC(:,35) = ALGEBRAIC(:,19)+ALGEBRAIC(:,8); ALGEBRAIC(:,1) = STATES(:,24)./CONSTANTS(:,4); ALGEBRAIC(:,67) = CONSTANTS(:,1).*CONSTANTS(:,2).*log( CONSTANTS(:,25).*STATES(:,17))+ CONSTANTS(:,43).*ALGEBRAIC(:,1); ALGEBRAIC(:,69) = CONSTANTS(:,9).*(exp(ALGEBRAIC(:,35)./( CONSTANTS(:,1).*CONSTANTS(:,2))) - exp(ALGEBRAIC(:,67)./( CONSTANTS(:,1).*CONSTANTS(:,2)))); ALGEBRAIC(:,70) = - ALGEBRAIC(:,53) - (ALGEBRAIC(:,61)+ALGEBRAIC(:,69)); RATES(:,4) = ALGEBRAIC(:,70); ALGEBRAIC(:,6) = CONSTANTS(:,1).*CONSTANTS(:,2).*log( CONSTANTS(:,39).*STATES(:,7)); ALGEBRAIC(:,30) = ALGEBRAIC(:,14)+ALGEBRAIC(:,6); ALGEBRAIC(:,15) = CONSTANTS(:,1).*CONSTANTS(:,2).*log( CONSTANTS(:,34).*STATES(:,11)); ALGEBRAIC(:,66) = ALGEBRAIC(:,15); ALGEBRAIC(:,68) = CONSTANTS(:,18).*(exp(ALGEBRAIC(:,30)./( CONSTANTS(:,1).*CONSTANTS(:,2))) - exp(ALGEBRAIC(:,66)./( CONSTANTS(:,1).*CONSTANTS(:,2)))); ALGEBRAIC(:,71) = - ALGEBRAIC(:,68); RATES(:,7) = ALGEBRAIC(:,71); ALGEBRAIC(:,72) = - ALGEBRAIC(:,68)+ALGEBRAIC(:,60); RATES(:,10) = ALGEBRAIC(:,72); ALGEBRAIC(:,73) = ALGEBRAIC(:,61) - ALGEBRAIC(:,69); RATES(:,16) = ALGEBRAIC(:,73); ALGEBRAIC(:,20) = CONSTANTS(:,1).*CONSTANTS(:,2).*log( CONSTANTS(:,25).*STATES(:,17)); ALGEBRAIC(:,36) = ALGEBRAIC(:,20); ALGEBRAIC(:,5) = CONSTANTS(:,1).*CONSTANTS(:,2).*log( CONSTANTS(:,40).*STATES(:,6)); ALGEBRAIC(:,21) = CONSTANTS(:,1).*CONSTANTS(:,2).*log( CONSTANTS(:,26).*STATES(:,9)); ALGEBRAIC(:,75) = ALGEBRAIC(:,21)+ALGEBRAIC(:,5); ALGEBRAIC(:,77) = CONSTANTS(:,10).*(exp(ALGEBRAIC(:,36)./( CONSTANTS(:,1).*CONSTANTS(:,2))) - exp(ALGEBRAIC(:,75)./( CONSTANTS(:,1).*CONSTANTS(:,2)))); ALGEBRAIC(:,78) = ALGEBRAIC(:,77); RATES(:,6) = ALGEBRAIC(:,78); ALGEBRAIC(:,31) = ALGEBRAIC(:,15); ALGEBRAIC(:,74) = ALGEBRAIC(:,9); ALGEBRAIC(:,76) = CONSTANTS(:,19).*(exp(ALGEBRAIC(:,31)./( CONSTANTS(:,1).*CONSTANTS(:,2))) - exp(ALGEBRAIC(:,74)./( CONSTANTS(:,1).*CONSTANTS(:,2)))); ALGEBRAIC(:,80) = ALGEBRAIC(:,68) - ALGEBRAIC(:,76); RATES(:,11) = ALGEBRAIC(:,80); ALGEBRAIC(:,81) = - ALGEBRAIC(:,41)+ALGEBRAIC(:,76); RATES(:,12) = ALGEBRAIC(:,81); ALGEBRAIC(:,82) = ALGEBRAIC(:,69) - ALGEBRAIC(:,77); RATES(:,17) = ALGEBRAIC(:,82); ALGEBRAIC(:,37) = ALGEBRAIC(:,21); ALGEBRAIC(:,22) = CONSTANTS(:,1).*CONSTANTS(:,2).*log( CONSTANTS(:,27).*STATES(:,22)); ALGEBRAIC(:,79) = ALGEBRAIC(:,22); ALGEBRAIC(:,83) = CONSTANTS(:,11).*(exp(ALGEBRAIC(:,37)./( CONSTANTS(:,1).*CONSTANTS(:,2))) - exp(ALGEBRAIC(:,79)./( CONSTANTS(:,1).*CONSTANTS(:,2)))); ALGEBRAIC(:,85) = ALGEBRAIC(:,77) - ALGEBRAIC(:,83); RATES(:,9) = ALGEBRAIC(:,85); ALGEBRAIC(:,38) = ALGEBRAIC(:,22); ALGEBRAIC(:,84) = CONSTANTS(:,44).*ALGEBRAIC(:,1)+ CONSTANTS(:,1).*CONSTANTS(:,2).*log( CONSTANTS(:,38).*STATES(:,3))+ CONSTANTS(:,1).*CONSTANTS(:,2).*log( CONSTANTS(:,28).*STATES(:,23)); ALGEBRAIC(:,86) = CONSTANTS(:,12).*(exp(ALGEBRAIC(:,38)./( CONSTANTS(:,1).*CONSTANTS(:,2))) - exp(ALGEBRAIC(:,84)./( CONSTANTS(:,1).*CONSTANTS(:,2)))); ALGEBRAIC(:,87) = CONSTANTS(:,44).*ALGEBRAIC(:,86)+ CONSTANTS(:,43).*ALGEBRAIC(:,69); RATES(:,24) = ALGEBRAIC(:,87); ALGEBRAIC(:,88) = - ALGEBRAIC(:,86)+ALGEBRAIC(:,83); RATES(:,22) = ALGEBRAIC(:,88); ALGEBRAIC(:,23) = CONSTANTS(:,1).*CONSTANTS(:,2).*log( CONSTANTS(:,28).*STATES(:,23)); ALGEBRAIC(:,39) = ALGEBRAIC(:,23); ALGEBRAIC(:,89) = ALGEBRAIC(:,10)+ALGEBRAIC(:,7); ALGEBRAIC(:,90) = CONSTANTS(:,13).*(exp(ALGEBRAIC(:,39)./( CONSTANTS(:,1).*CONSTANTS(:,2))) - exp(ALGEBRAIC(:,89)./( CONSTANTS(:,1).*CONSTANTS(:,2)))); ALGEBRAIC(:,91) = ALGEBRAIC(:,86)+ALGEBRAIC(:,90)+ALGEBRAIC(:,43); RATES(:,3) = ALGEBRAIC(:,91); ALGEBRAIC(:,92) = ALGEBRAIC(:,90) - ALGEBRAIC(:,43); RATES(:,18) = ALGEBRAIC(:,92); ALGEBRAIC(:,93) = ALGEBRAIC(:,86) - ALGEBRAIC(:,90); RATES(:,23) = ALGEBRAIC(:,93); 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(:,9) = CONSTANTS(:,1).*CONSTANTS(:,2).*log( CONSTANTS(:,20).*STATES(:,12)); ALGEBRAIC(:,25) = ALGEBRAIC(:,9); ALGEBRAIC(:,4) = CONSTANTS(:,1).*CONSTANTS(:,2).*log( CONSTANTS(:,35).*STATES(:,2)); ALGEBRAIC(:,16) = CONSTANTS(:,1).*CONSTANTS(:,2).*log( CONSTANTS(:,21).*STATES(:,13)); ALGEBRAIC(:,40) = ALGEBRAIC(:,4)+ALGEBRAIC(:,16); ALGEBRAIC(:,41) = CONSTANTS(:,5).*(exp(ALGEBRAIC(:,25)./( CONSTANTS(:,1).*CONSTANTS(:,2))) - exp(ALGEBRAIC(:,40)./( CONSTANTS(:,1).*CONSTANTS(:,2)))); ALGEBRAIC(:,32) = ALGEBRAIC(:,16); ALGEBRAIC(:,17) = CONSTANTS(:,1).*CONSTANTS(:,2).*log( CONSTANTS(:,22).*STATES(:,14)); ALGEBRAIC(:,44) = ALGEBRAIC(:,17)+ALGEBRAIC(:,4); ALGEBRAIC(:,46) = CONSTANTS(:,6).*(exp(ALGEBRAIC(:,32)./( CONSTANTS(:,1).*CONSTANTS(:,2))) - exp(ALGEBRAIC(:,44)./( CONSTANTS(:,1).*CONSTANTS(:,2)))); ALGEBRAIC(:,48) = ALGEBRAIC(:,41)+ALGEBRAIC(:,46); ALGEBRAIC(:,50) = - ALGEBRAIC(:,46)+ALGEBRAIC(:,41); ALGEBRAIC(:,10) = CONSTANTS(:,1).*CONSTANTS(:,2).*log( CONSTANTS(:,29).*STATES(:,18)); ALGEBRAIC(:,26) = ALGEBRAIC(:,10); ALGEBRAIC(:,7) = CONSTANTS(:,1).*CONSTANTS(:,2).*log( CONSTANTS(:,38).*STATES(:,3)); ALGEBRAIC(:,11) = CONSTANTS(:,1).*CONSTANTS(:,2).*log( CONSTANTS(:,30).*STATES(:,19)); ALGEBRAIC(:,42) = ALGEBRAIC(:,7)+ALGEBRAIC(:,11); ALGEBRAIC(:,43) = CONSTANTS(:,14).*(exp(ALGEBRAIC(:,26)./( CONSTANTS(:,1).*CONSTANTS(:,2))) - exp(ALGEBRAIC(:,42)./( CONSTANTS(:,1).*CONSTANTS(:,2)))); ALGEBRAIC(:,3) = CONSTANTS(:,1).*CONSTANTS(:,2).*log( CONSTANTS(:,36).*STATES(:,1)); ALGEBRAIC(:,27) = ALGEBRAIC(:,11)+ALGEBRAIC(:,3); ALGEBRAIC(:,12) = CONSTANTS(:,1).*CONSTANTS(:,2).*log( CONSTANTS(:,31).*STATES(:,20)); ALGEBRAIC(:,45) = ALGEBRAIC(:,12); ALGEBRAIC(:,47) = CONSTANTS(:,15).*(exp(ALGEBRAIC(:,27)./( CONSTANTS(:,1).*CONSTANTS(:,2))) - exp(ALGEBRAIC(:,45)./( CONSTANTS(:,1).*CONSTANTS(:,2)))); ALGEBRAIC(:,51) = ALGEBRAIC(:,43) - ALGEBRAIC(:,47); ALGEBRAIC(:,28) = ALGEBRAIC(:,12)+ALGEBRAIC(:,3); ALGEBRAIC(:,13) = CONSTANTS(:,1).*CONSTANTS(:,2).*log( CONSTANTS(:,32).*STATES(:,21)); ALGEBRAIC(:,52) = ALGEBRAIC(:,13); ALGEBRAIC(:,54) = CONSTANTS(:,16).*(exp(ALGEBRAIC(:,28)./( CONSTANTS(:,1).*CONSTANTS(:,2))) - exp(ALGEBRAIC(:,52)./( CONSTANTS(:,1).*CONSTANTS(:,2)))); ALGEBRAIC(:,55) = - ALGEBRAIC(:,47) - ALGEBRAIC(:,54); ALGEBRAIC(:,8) = CONSTANTS(:,1).*CONSTANTS(:,2).*log( CONSTANTS(:,37).*STATES(:,4)); ALGEBRAIC(:,33) = ALGEBRAIC(:,17)+ALGEBRAIC(:,8); ALGEBRAIC(:,18) = CONSTANTS(:,1).*CONSTANTS(:,2).*log( CONSTANTS(:,23).*STATES(:,15)); ALGEBRAIC(:,49) = ALGEBRAIC(:,18); ALGEBRAIC(:,53) = CONSTANTS(:,7).*(exp(ALGEBRAIC(:,33)./( CONSTANTS(:,1).*CONSTANTS(:,2))) - exp(ALGEBRAIC(:,49)./( CONSTANTS(:,1).*CONSTANTS(:,2)))); ALGEBRAIC(:,57) = ALGEBRAIC(:,46) - ALGEBRAIC(:,53); ALGEBRAIC(:,58) = - ALGEBRAIC(:,54)+ALGEBRAIC(:,47); ALGEBRAIC(:,29) = ALGEBRAIC(:,13); ALGEBRAIC(:,2) = CONSTANTS(:,1).*CONSTANTS(:,2).*log( CONSTANTS(:,42).*STATES(:,5)); ALGEBRAIC(:,24) = CONSTANTS(:,1).*CONSTANTS(:,2).*log( CONSTANTS(:,41).*STATES(:,8)); ALGEBRAIC(:,14) = CONSTANTS(:,1).*CONSTANTS(:,2).*log( CONSTANTS(:,33).*STATES(:,10)); ALGEBRAIC(:,59) = ALGEBRAIC(:,2)+ALGEBRAIC(:,24)+ALGEBRAIC(:,14); ALGEBRAIC(:,60) = CONSTANTS(:,17).*(exp(ALGEBRAIC(:,29)./( CONSTANTS(:,1).*CONSTANTS(:,2))) - exp(ALGEBRAIC(:,59)./( CONSTANTS(:,1).*CONSTANTS(:,2)))); ALGEBRAIC(:,62) = ALGEBRAIC(:,60); ALGEBRAIC(:,63) = ALGEBRAIC(:,60); ALGEBRAIC(:,34) = ALGEBRAIC(:,18)+ALGEBRAIC(:,8); ALGEBRAIC(:,19) = CONSTANTS(:,1).*CONSTANTS(:,2).*log( CONSTANTS(:,24).*STATES(:,16)); ALGEBRAIC(:,56) = ALGEBRAIC(:,19); ALGEBRAIC(:,61) = CONSTANTS(:,8).*(exp(ALGEBRAIC(:,34)./( CONSTANTS(:,1).*CONSTANTS(:,2))) - exp(ALGEBRAIC(:,56)./( CONSTANTS(:,1).*CONSTANTS(:,2)))); ALGEBRAIC(:,64) = ALGEBRAIC(:,53) - ALGEBRAIC(:,61); ALGEBRAIC(:,65) = ALGEBRAIC(:,54) - ALGEBRAIC(:,60); ALGEBRAIC(:,35) = ALGEBRAIC(:,19)+ALGEBRAIC(:,8); ALGEBRAIC(:,1) = STATES(:,24)./CONSTANTS(:,4); ALGEBRAIC(:,67) = CONSTANTS(:,1).*CONSTANTS(:,2).*log( CONSTANTS(:,25).*STATES(:,17))+ CONSTANTS(:,43).*ALGEBRAIC(:,1); ALGEBRAIC(:,69) = CONSTANTS(:,9).*(exp(ALGEBRAIC(:,35)./( CONSTANTS(:,1).*CONSTANTS(:,2))) - exp(ALGEBRAIC(:,67)./( CONSTANTS(:,1).*CONSTANTS(:,2)))); ALGEBRAIC(:,70) = - ALGEBRAIC(:,53) - (ALGEBRAIC(:,61)+ALGEBRAIC(:,69)); ALGEBRAIC(:,6) = CONSTANTS(:,1).*CONSTANTS(:,2).*log( CONSTANTS(:,39).*STATES(:,7)); ALGEBRAIC(:,30) = ALGEBRAIC(:,14)+ALGEBRAIC(:,6); ALGEBRAIC(:,15) = CONSTANTS(:,1).*CONSTANTS(:,2).*log( CONSTANTS(:,34).*STATES(:,11)); ALGEBRAIC(:,66) = ALGEBRAIC(:,15); ALGEBRAIC(:,68) = CONSTANTS(:,18).*(exp(ALGEBRAIC(:,30)./( CONSTANTS(:,1).*CONSTANTS(:,2))) - exp(ALGEBRAIC(:,66)./( CONSTANTS(:,1).*CONSTANTS(:,2)))); ALGEBRAIC(:,71) = - ALGEBRAIC(:,68); ALGEBRAIC(:,72) = - ALGEBRAIC(:,68)+ALGEBRAIC(:,60); ALGEBRAIC(:,73) = ALGEBRAIC(:,61) - ALGEBRAIC(:,69); ALGEBRAIC(:,20) = CONSTANTS(:,1).*CONSTANTS(:,2).*log( CONSTANTS(:,25).*STATES(:,17)); ALGEBRAIC(:,36) = ALGEBRAIC(:,20); ALGEBRAIC(:,5) = CONSTANTS(:,1).*CONSTANTS(:,2).*log( CONSTANTS(:,40).*STATES(:,6)); ALGEBRAIC(:,21) = CONSTANTS(:,1).*CONSTANTS(:,2).*log( CONSTANTS(:,26).*STATES(:,9)); ALGEBRAIC(:,75) = ALGEBRAIC(:,21)+ALGEBRAIC(:,5); ALGEBRAIC(:,77) = CONSTANTS(:,10).*(exp(ALGEBRAIC(:,36)./( CONSTANTS(:,1).*CONSTANTS(:,2))) - exp(ALGEBRAIC(:,75)./( CONSTANTS(:,1).*CONSTANTS(:,2)))); ALGEBRAIC(:,78) = ALGEBRAIC(:,77); ALGEBRAIC(:,31) = ALGEBRAIC(:,15); ALGEBRAIC(:,74) = ALGEBRAIC(:,9); ALGEBRAIC(:,76) = CONSTANTS(:,19).*(exp(ALGEBRAIC(:,31)./( CONSTANTS(:,1).*CONSTANTS(:,2))) - exp(ALGEBRAIC(:,74)./( CONSTANTS(:,1).*CONSTANTS(:,2)))); ALGEBRAIC(:,80) = ALGEBRAIC(:,68) - ALGEBRAIC(:,76); ALGEBRAIC(:,81) = - ALGEBRAIC(:,41)+ALGEBRAIC(:,76); ALGEBRAIC(:,82) = ALGEBRAIC(:,69) - ALGEBRAIC(:,77); ALGEBRAIC(:,37) = ALGEBRAIC(:,21); ALGEBRAIC(:,22) = CONSTANTS(:,1).*CONSTANTS(:,2).*log( CONSTANTS(:,27).*STATES(:,22)); ALGEBRAIC(:,79) = ALGEBRAIC(:,22); ALGEBRAIC(:,83) = CONSTANTS(:,11).*(exp(ALGEBRAIC(:,37)./( CONSTANTS(:,1).*CONSTANTS(:,2))) - exp(ALGEBRAIC(:,79)./( CONSTANTS(:,1).*CONSTANTS(:,2)))); ALGEBRAIC(:,85) = ALGEBRAIC(:,77) - ALGEBRAIC(:,83); ALGEBRAIC(:,38) = ALGEBRAIC(:,22); ALGEBRAIC(:,84) = CONSTANTS(:,44).*ALGEBRAIC(:,1)+ CONSTANTS(:,1).*CONSTANTS(:,2).*log( CONSTANTS(:,38).*STATES(:,3))+ CONSTANTS(:,1).*CONSTANTS(:,2).*log( CONSTANTS(:,28).*STATES(:,23)); ALGEBRAIC(:,86) = CONSTANTS(:,12).*(exp(ALGEBRAIC(:,38)./( CONSTANTS(:,1).*CONSTANTS(:,2))) - exp(ALGEBRAIC(:,84)./( CONSTANTS(:,1).*CONSTANTS(:,2)))); ALGEBRAIC(:,87) = CONSTANTS(:,44).*ALGEBRAIC(:,86)+ CONSTANTS(:,43).*ALGEBRAIC(:,69); ALGEBRAIC(:,88) = - ALGEBRAIC(:,86)+ALGEBRAIC(:,83); ALGEBRAIC(:,23) = CONSTANTS(:,1).*CONSTANTS(:,2).*log( CONSTANTS(:,28).*STATES(:,23)); ALGEBRAIC(:,39) = ALGEBRAIC(:,23); ALGEBRAIC(:,89) = ALGEBRAIC(:,10)+ALGEBRAIC(:,7); ALGEBRAIC(:,90) = CONSTANTS(:,13).*(exp(ALGEBRAIC(:,39)./( CONSTANTS(:,1).*CONSTANTS(:,2))) - exp(ALGEBRAIC(:,89)./( CONSTANTS(:,1).*CONSTANTS(:,2)))); ALGEBRAIC(:,91) = ALGEBRAIC(:,86)+ALGEBRAIC(:,90)+ALGEBRAIC(:,43); ALGEBRAIC(:,92) = ALGEBRAIC(:,90) - ALGEBRAIC(:,43); ALGEBRAIC(:,93) = ALGEBRAIC(:,86) - ALGEBRAIC(:,90); 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