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 =71; end % There are a total of 56 entries in each of the rate and state variable arrays. % There are a total of 105 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 cell (millisecond)'); LEGEND_CONSTANTS(:,1) = strpad('C_m in component wal_environment (microF_per_cm2)'); LEGEND_CONSTANTS(:,2) = strpad('gam in component wal_environment (dimensionless)'); LEGEND_CONSTANTS(:,3) = strpad('R_a in component wal_environment (ohm_cm2)'); LEGEND_CONSTANTS(:,4) = strpad('tsi in component wal_environment (centi_metre)'); LEGEND_CONSTANTS(:,5) = strpad('tsi2 in component wal_environment (centi_metre)'); LEGEND_CONSTANTS(:,6) = strpad('tsi3 in component wal_environment (centi_metre)'); LEGEND_CONSTANTS(:,7) = strpad('FF in component wal_environment (C_per_mol)'); LEGEND_CONSTANTS(:,8) = strpad('tau_K in component wal_environment (millisecond)'); LEGEND_CONSTANTS(:,9) = strpad('tau_Na in component wal_environment (millisecond)'); LEGEND_CONSTANTS(:,10) = strpad('f_T in component wal_environment (dimensionless)'); LEGEND_CONSTANTS(:,11) = strpad('tau_K2 in component wal_environment (millisecond)'); LEGEND_CONSTANTS(:,12) = strpad('tau_Na2 in component wal_environment (millisecond)'); LEGEND_CONSTANTS(:,13) = strpad('I_K_rest in component wal_environment (microA_per_cm2)'); LEGEND_CONSTANTS(:,14) = strpad('I_Na_rest in component wal_environment (microA_per_cm2)'); LEGEND_CONSTANTS(:,15) = strpad('alpha_h_bar in component wal_environment (per_millisecond)'); LEGEND_CONSTANTS(:,16) = strpad('alpha_m_bar in component wal_environment (per_millisecond_per_millivolt)'); LEGEND_CONSTANTS(:,17) = strpad('alpha_n_bar in component wal_environment (per_millisecond_per_millivolt)'); LEGEND_CONSTANTS(:,18) = strpad('beta_h_bar in component wal_environment (per_millisecond)'); LEGEND_CONSTANTS(:,19) = strpad('beta_m_bar in component wal_environment (per_millisecond)'); LEGEND_CONSTANTS(:,20) = strpad('beta_n_bar in component wal_environment (per_millisecond)'); LEGEND_CONSTANTS(:,21) = strpad('V_m in component wal_environment (millivolt)'); LEGEND_CONSTANTS(:,22) = strpad('V_n in component wal_environment (millivolt)'); LEGEND_CONSTANTS(:,23) = strpad('V_h in component wal_environment (millivolt)'); LEGEND_CONSTANTS(:,24) = strpad('V_a in component wal_environment (millivolt)'); LEGEND_CONSTANTS(:,25) = strpad('V_S_inf in component wal_environment (millivolt)'); LEGEND_CONSTANTS(:,26) = strpad('V_h_K_inf in component wal_environment (millivolt)'); LEGEND_CONSTANTS(:,27) = strpad('A_a in component wal_environment (millivolt)'); LEGEND_CONSTANTS(:,28) = strpad('A_S_inf in component wal_environment (millivolt)'); LEGEND_CONSTANTS(:,29) = strpad('A_h_K_inf in component wal_environment (millivolt)'); LEGEND_CONSTANTS(:,30) = strpad('K_alpha_h in component wal_environment (millivolt)'); LEGEND_CONSTANTS(:,31) = strpad('K_beta_h in component wal_environment (millivolt)'); LEGEND_CONSTANTS(:,32) = strpad('K_alpha_m in component wal_environment (millivolt)'); LEGEND_CONSTANTS(:,33) = strpad('K_alpha_n in component wal_environment (millivolt)'); LEGEND_CONSTANTS(:,34) = strpad('K_beta_m in component wal_environment (millivolt)'); LEGEND_CONSTANTS(:,35) = strpad('K_beta_n in component wal_environment (millivolt)'); LEGEND_CONSTANTS(:,36) = strpad('RR in component wal_environment (milliJ_per_degreeK_per_mol)'); LEGEND_CONSTANTS(:,37) = strpad('TT in component wal_environment (degreeK)'); LEGEND_CONSTANTS(:,38) = strpad('g_Cl_bar in component wal_environment (milliS_per_cm2)'); LEGEND_CONSTANTS(:,39) = strpad('g_K_bar in component wal_environment (milliS_per_cm2)'); LEGEND_CONSTANTS(:,40) = strpad('g_Na_bar in component wal_environment (milliS_per_cm2)'); LEGEND_CONSTANTS(:,41) = strpad('G_K in component wal_environment (milliS_per_cm2)'); LEGEND_CONSTANTS(:,42) = strpad('del in component wal_environment (dimensionless)'); LEGEND_CONSTANTS(:,43) = strpad('K_K in component wal_environment (milliM2)'); LEGEND_CONSTANTS(:,44) = strpad('K_S in component wal_environment (milliM2)'); LEGEND_CONSTANTS(:,45) = strpad('K_m_K in component wal_environment (milliM)'); LEGEND_CONSTANTS(:,46) = strpad('K_m_Na in component wal_environment (milliM)'); LEGEND_CONSTANTS(:,47) = strpad('S_i in component wal_environment (milliM)'); LEGEND_CONSTANTS(:,48) = strpad('J_NaK_bar in component wal_environment (micro_mol_per_cm2_per_second)'); LEGEND_CONSTANTS(:,49) = strpad('V_tau in component wal_environment (millivolt)'); LEGEND_ALGEBRAIC(:,1) = strpad('I_T in component wal_environment (microA_per_cm2)'); LEGEND_STATES(:,1) = strpad('vS in component wal_environment (millivolt)'); LEGEND_STATES(:,2) = strpad('vT in component wal_environment (millivolt)'); LEGEND_ALGEBRAIC(:,52) = strpad('I_ionic_s in component wal_environment (microA_per_cm2)'); LEGEND_ALGEBRAIC(:,71) = strpad('I_ionic_t in component wal_environment (microA_per_cm2)'); LEGEND_STATES(:,3) = strpad('K_t in component wal_environment (milliM)'); LEGEND_STATES(:,4) = strpad('K_i in component wal_environment (milliM)'); LEGEND_STATES(:,5) = strpad('K_e in component wal_environment (milliM)'); LEGEND_STATES(:,6) = strpad('Na_i in component wal_environment (milliM)'); LEGEND_STATES(:,7) = strpad('Na_t in component wal_environment (milliM)'); LEGEND_STATES(:,8) = strpad('Na_e in component wal_environment (milliM)'); LEGEND_ALGEBRAIC(:,14) = strpad('E_K in component wal_environment (millivolt)'); LEGEND_ALGEBRAIC(:,26) = strpad('E_K_t in component wal_environment (millivolt)'); LEGEND_ALGEBRAIC(:,27) = strpad('Cl_i in component wal_environment (milliM)'); LEGEND_ALGEBRAIC(:,28) = strpad('Cl_o in component wal_environment (milliM)'); LEGEND_ALGEBRAIC(:,29) = strpad('Cl_i_t in component wal_environment (milliM)'); LEGEND_ALGEBRAIC(:,30) = strpad('Cl_o_t in component wal_environment (milliM)'); LEGEND_ALGEBRAIC(:,31) = strpad('J_K in component wal_environment (milliV_milliM)'); LEGEND_ALGEBRAIC(:,32) = strpad('J_K_t in component wal_environment (milliV_milliM)'); LEGEND_CONSTANTS(:,50) = strpad('eta_Cl in component wal_environment (dimensionless)'); LEGEND_CONSTANTS(:,51) = strpad('eta_IR in component wal_environment (dimensionless)'); LEGEND_CONSTANTS(:,52) = strpad('eta_DR in component wal_environment (dimensionless)'); LEGEND_CONSTANTS(:,53) = strpad('eta_Na in component wal_environment (dimensionless)'); LEGEND_CONSTANTS(:,54) = strpad('eta_NaK in component wal_environment (dimensionless)'); LEGEND_ALGEBRAIC(:,37) = strpad('I_Cl in component sarco_Cl_channel (microA_per_cm2)'); LEGEND_ALGEBRAIC(:,42) = strpad('I_IR in component sarco_IR_channel (microA_per_cm2)'); LEGEND_ALGEBRAIC(:,44) = strpad('I_DR in component sarco_DR_channel (microA_per_cm2)'); LEGEND_ALGEBRAIC(:,47) = strpad('I_Na in component sarco_Na_channel (microA_per_cm2)'); LEGEND_ALGEBRAIC(:,51) = strpad('I_NaK in component sarco_NaK_channel (microA_per_cm2)'); LEGEND_ALGEBRAIC(:,56) = strpad('I_Cl_t in component t_Cl_channel (microA_per_cm2)'); LEGEND_ALGEBRAIC(:,61) = strpad('I_IR_t in component t_IR_channel (microA_per_cm2)'); LEGEND_ALGEBRAIC(:,63) = strpad('I_DR_t in component t_DR_channel (microA_per_cm2)'); LEGEND_ALGEBRAIC(:,66) = strpad('I_Na_t in component t_Na_channel (microA_per_cm2)'); LEGEND_ALGEBRAIC(:,70) = strpad('I_NaK_t in component t_NaK_channel (microA_per_cm2)'); LEGEND_ALGEBRAIC(:,33) = strpad('I_HH in component wal_environment (microA_per_cm2)'); LEGEND_ALGEBRAIC(:,34) = strpad('a in component sarco_Cl_channel (dimensionless)'); LEGEND_ALGEBRAIC(:,35) = strpad('J_Cl in component sarco_Cl_channel (milliV_milliM)'); LEGEND_ALGEBRAIC(:,36) = strpad('g_Cl in component sarco_Cl_channel (milliS_per_cm2)'); LEGEND_ALGEBRAIC(:,38) = strpad('K_R in component sarco_IR_channel (milliM)'); LEGEND_ALGEBRAIC(:,39) = strpad('g_IR_bar in component sarco_IR_channel (milliS_per_cm2)'); LEGEND_ALGEBRAIC(:,40) = strpad('y in component sarco_IR_channel (dimensionless)'); LEGEND_ALGEBRAIC(:,41) = strpad('g_IR in component sarco_IR_channel (milliS_per_cm2)'); LEGEND_ALGEBRAIC(:,2) = strpad('alpha_n in component sarco_DR_channel (per_millisecond)'); LEGEND_ALGEBRAIC(:,15) = strpad('beta_n in component sarco_DR_channel (per_millisecond)'); LEGEND_ALGEBRAIC(:,3) = strpad('h_K_inf in component sarco_DR_channel (dimensionless)'); LEGEND_ALGEBRAIC(:,16) = strpad('tau_h_K in component sarco_DR_channel (millisecond)'); LEGEND_STATES(:,9) = strpad('n in component sarco_DR_channel (dimensionless)'); LEGEND_STATES(:,10) = strpad('h_K in component sarco_DR_channel (dimensionless)'); LEGEND_ALGEBRAIC(:,43) = strpad('g_DR in component sarco_DR_channel (milliS_per_cm2)'); LEGEND_ALGEBRAIC(:,4) = strpad('alpha_h in component sarco_Na_channel (per_millisecond)'); LEGEND_ALGEBRAIC(:,17) = strpad('beta_h in component sarco_Na_channel (per_millisecond)'); LEGEND_ALGEBRAIC(:,5) = strpad('alpha_m in component sarco_Na_channel (per_millisecond)'); LEGEND_ALGEBRAIC(:,18) = strpad('beta_m in component sarco_Na_channel (per_millisecond)'); LEGEND_ALGEBRAIC(:,6) = strpad('S_inf in component sarco_Na_channel (dimensionless)'); LEGEND_ALGEBRAIC(:,19) = strpad('tau_S in component sarco_Na_channel (millisecond)'); LEGEND_STATES(:,11) = strpad('m in component sarco_Na_channel (dimensionless)'); LEGEND_STATES(:,12) = strpad('h in component sarco_Na_channel (dimensionless)'); LEGEND_STATES(:,13) = strpad('S in component sarco_Na_channel (dimensionless)'); LEGEND_ALGEBRAIC(:,46) = strpad('g_Na in component sarco_Na_channel (milliS_per_cm2)'); LEGEND_ALGEBRAIC(:,45) = strpad('J_Na in component sarco_Na_channel (milliV_milliM)'); LEGEND_ALGEBRAIC(:,48) = strpad('sig in component sarco_NaK_channel (dimensionless)'); LEGEND_ALGEBRAIC(:,49) = strpad('f1 in component sarco_NaK_channel (dimensionless)'); LEGEND_ALGEBRAIC(:,50) = strpad('I_NaK_bar in component sarco_NaK_channel (microA_per_cm2)'); LEGEND_ALGEBRAIC(:,53) = strpad('a_t in component t_Cl_channel (dimensionless)'); LEGEND_ALGEBRAIC(:,54) = strpad('J_Cl_t in component t_Cl_channel (milliV_milliM)'); LEGEND_ALGEBRAIC(:,55) = strpad('g_Cl_t in component t_Cl_channel (milliS_per_cm2)'); LEGEND_ALGEBRAIC(:,57) = strpad('K_R_t in component t_IR_channel (milliM)'); LEGEND_ALGEBRAIC(:,58) = strpad('g_IR_bar_t in component t_IR_channel (milliS_per_cm2)'); LEGEND_ALGEBRAIC(:,59) = strpad('y_t in component t_IR_channel (dimensionless)'); LEGEND_ALGEBRAIC(:,60) = strpad('g_IR_t in component t_IR_channel (milliS_per_cm2)'); LEGEND_ALGEBRAIC(:,7) = strpad('alpha_n_t in component t_DR_channel (per_millisecond)'); LEGEND_ALGEBRAIC(:,20) = strpad('beta_n_t in component t_DR_channel (per_millisecond)'); LEGEND_ALGEBRAIC(:,8) = strpad('h_K_inf_t in component t_DR_channel (dimensionless)'); LEGEND_ALGEBRAIC(:,21) = strpad('tau_h_K_t in component t_DR_channel (millisecond)'); LEGEND_STATES(:,14) = strpad('n_t in component t_DR_channel (dimensionless)'); LEGEND_STATES(:,15) = strpad('h_K_t in component t_DR_channel (dimensionless)'); LEGEND_ALGEBRAIC(:,62) = strpad('g_DR_t in component t_DR_channel (milliS_per_cm2)'); LEGEND_ALGEBRAIC(:,9) = strpad('alpha_h_t in component t_Na_channel (per_millisecond)'); LEGEND_ALGEBRAIC(:,22) = strpad('beta_h_t in component t_Na_channel (per_millisecond)'); LEGEND_ALGEBRAIC(:,10) = strpad('alpha_m_t in component t_Na_channel (per_millisecond)'); LEGEND_ALGEBRAIC(:,23) = strpad('beta_m_t in component t_Na_channel (per_millisecond)'); LEGEND_ALGEBRAIC(:,11) = strpad('S_inf_t in component t_Na_channel (dimensionless)'); LEGEND_ALGEBRAIC(:,24) = strpad('tau_S_t in component t_Na_channel (millisecond)'); LEGEND_STATES(:,16) = strpad('m_t in component t_Na_channel (dimensionless)'); LEGEND_STATES(:,17) = strpad('h_t in component t_Na_channel (dimensionless)'); LEGEND_STATES(:,18) = strpad('S_t in component t_Na_channel (dimensionless)'); LEGEND_ALGEBRAIC(:,65) = strpad('g_Na_t in component t_Na_channel (milliS_per_cm2)'); LEGEND_ALGEBRAIC(:,64) = strpad('J_Na_t in component t_Na_channel (milliV_milliM)'); LEGEND_ALGEBRAIC(:,67) = strpad('sig_t in component t_NaK_channel (dimensionless)'); LEGEND_ALGEBRAIC(:,68) = strpad('f1_t in component t_NaK_channel (dimensionless)'); LEGEND_ALGEBRAIC(:,69) = strpad('I_NaK_bar_t in component t_NaK_channel (microA_per_cm2)'); LEGEND_STATES(:,19) = strpad('O_0 in component sternrios (dimensionless)'); LEGEND_STATES(:,20) = strpad('O_1 in component sternrios (dimensionless)'); LEGEND_STATES(:,21) = strpad('O_2 in component sternrios (dimensionless)'); LEGEND_STATES(:,22) = strpad('O_3 in component sternrios (dimensionless)'); LEGEND_STATES(:,23) = strpad('O_4 in component sternrios (dimensionless)'); LEGEND_CONSTANTS(:,55) = strpad('k_L in component sternrios (per_millisecond)'); LEGEND_CONSTANTS(:,56) = strpad('k_Lm in component sternrios (per_millisecond)'); LEGEND_CONSTANTS(:,57) = strpad('f in component sternrios (dimensionless)'); LEGEND_CONSTANTS(:,58) = strpad('alpha1 in component sternrios (per_millisecond)'); LEGEND_CONSTANTS(:,59) = strpad('K in component sternrios (millivolt)'); LEGEND_CONSTANTS(:,60) = strpad('Vbar in component sternrios (millivolt)'); LEGEND_STATES(:,24) = strpad('C_0 in component sternrios (dimensionless)'); LEGEND_STATES(:,25) = strpad('C_1 in component sternrios (dimensionless)'); LEGEND_STATES(:,26) = strpad('C_2 in component sternrios (dimensionless)'); LEGEND_STATES(:,27) = strpad('C_3 in component sternrios (dimensionless)'); LEGEND_STATES(:,28) = strpad('C_4 in component sternrios (dimensionless)'); LEGEND_ALGEBRAIC(:,12) = strpad('k_C in component sternrios (per_millisecond)'); LEGEND_ALGEBRAIC(:,25) = strpad('k_Cm in component sternrios (per_millisecond)'); LEGEND_CONSTANTS(:,61) = strpad('nu_SR in component razumova (micromolar_per_millisecond_micrometre3)'); LEGEND_CONSTANTS(:,62) = strpad('K_SR in component razumova (micromolar)'); LEGEND_CONSTANTS(:,63) = strpad('L_e in component razumova (micrometre3_per_millisecond)'); LEGEND_CONSTANTS(:,64) = strpad('tau_R in component razumova (micrometre3_per_millisecond)'); LEGEND_CONSTANTS(:,65) = strpad('tau_SR_R in component razumova (micrometre3_per_millisecond)'); LEGEND_CONSTANTS(:,66) = strpad('L_x in component razumova (micrometre)'); LEGEND_CONSTANTS(:,67) = strpad('R_R in component razumova (micrometre)'); LEGEND_CONSTANTS(:,100) = strpad('V_o in component razumova (micrometre3)'); LEGEND_CONSTANTS(:,102) = strpad('V_1 in component razumova (micrometre3)'); LEGEND_CONSTANTS(:,103) = strpad('V_2 in component razumova (micrometre3)'); LEGEND_CONSTANTS(:,101) = strpad('V_SR in component razumova (micrometre3)'); LEGEND_CONSTANTS(:,104) = strpad('V_SR1 in component razumova (micrometre3)'); LEGEND_CONSTANTS(:,105) = strpad('V_SR2 in component razumova (micrometre3)'); LEGEND_CONSTANTS(:,68) = strpad('k_T_on in component razumova (per_micromolar_per_millisecond)'); LEGEND_CONSTANTS(:,69) = strpad('k_T_off in component razumova (per_millisecond)'); LEGEND_CONSTANTS(:,70) = strpad('T_tot in component razumova (micromolar)'); LEGEND_CONSTANTS(:,71) = strpad('k_P_on in component razumova (per_micromolar_per_millisecond)'); LEGEND_CONSTANTS(:,72) = strpad('k_P_off in component razumova (per_millisecond)'); LEGEND_CONSTANTS(:,73) = strpad('P_tot in component razumova (micromolar)'); LEGEND_CONSTANTS(:,74) = strpad('k_Mg_on in component razumova (per_micromolar_per_millisecond)'); LEGEND_CONSTANTS(:,75) = strpad('k_Mg_off in component razumova (per_millisecond)'); LEGEND_CONSTANTS(:,76) = strpad('k_Cs_on in component razumova (per_micromolar_per_millisecond)'); LEGEND_CONSTANTS(:,77) = strpad('k_Cs_off in component razumova (per_millisecond)'); LEGEND_CONSTANTS(:,78) = strpad('Cs_tot in component razumova (micromolar)'); LEGEND_CONSTANTS(:,79) = strpad('k_CATP_on in component razumova (per_micromolar_per_millisecond)'); LEGEND_CONSTANTS(:,80) = strpad('k_CATP_off in component razumova (per_millisecond)'); LEGEND_CONSTANTS(:,81) = strpad('k_MATP_on in component razumova (per_micromolar_per_millisecond)'); LEGEND_CONSTANTS(:,82) = strpad('k_MATP_off in component razumova (per_millisecond)'); LEGEND_CONSTANTS(:,83) = strpad('tau_ATP in component razumova (micrometre3_per_millisecond)'); LEGEND_CONSTANTS(:,84) = strpad('tau_Mg in component razumova (micrometre3_per_millisecond)'); LEGEND_CONSTANTS(:,85) = strpad('k_0_on in component razumova (per_millisecond)'); LEGEND_CONSTANTS(:,86) = strpad('k_0_off in component razumova (per_millisecond)'); LEGEND_CONSTANTS(:,87) = strpad('k_Ca_on in component razumova (per_millisecond)'); LEGEND_CONSTANTS(:,88) = strpad('k_Ca_off in component razumova (per_millisecond)'); LEGEND_CONSTANTS(:,89) = strpad('f_o in component razumova (per_millisecond)'); LEGEND_CONSTANTS(:,90) = strpad('f_p in component razumova (per_millisecond)'); LEGEND_CONSTANTS(:,91) = strpad('h_o in component razumova (per_millisecond)'); LEGEND_CONSTANTS(:,92) = strpad('h_p in component razumova (per_millisecond)'); LEGEND_CONSTANTS(:,93) = strpad('g_o in component razumova (per_millisecond)'); LEGEND_CONSTANTS(:,94) = strpad('b_p in component razumova (per_millisecond)'); LEGEND_CONSTANTS(:,95) = strpad('k_p in component razumova (micrometre3_per_millisecond)'); LEGEND_CONSTANTS(:,96) = strpad('A_p in component razumova (per_milliM3_per_millisecond)'); LEGEND_CONSTANTS(:,97) = strpad('B_p in component razumova (per_milliM2_per_millisecond)'); LEGEND_CONSTANTS(:,98) = strpad('PP in component razumova (milliM2)'); LEGEND_ALGEBRAIC(:,13) = strpad('T_0 in component razumova (micromolar)'); LEGEND_STATES(:,29) = strpad('Ca_1 in component razumova (micromolar)'); LEGEND_STATES(:,30) = strpad('Ca_SR1 in component razumova (micromolar)'); LEGEND_STATES(:,31) = strpad('Ca_2 in component razumova (micromolar)'); LEGEND_STATES(:,32) = strpad('Ca_SR2 in component razumova (micromolar)'); LEGEND_STATES(:,33) = strpad('Ca_T_2 in component razumova (micromolar)'); LEGEND_STATES(:,34) = strpad('Ca_P1 in component razumova (micromolar)'); LEGEND_STATES(:,35) = strpad('Ca_P2 in component razumova (micromolar)'); LEGEND_STATES(:,36) = strpad('Mg_P1 in component razumova (micromolar)'); LEGEND_STATES(:,37) = strpad('Mg_P2 in component razumova (micromolar)'); LEGEND_STATES(:,38) = strpad('Ca_Cs1 in component razumova (micromolar)'); LEGEND_STATES(:,39) = strpad('Ca_Cs2 in component razumova (micromolar)'); LEGEND_STATES(:,40) = strpad('Ca_ATP1 in component razumova (micromolar)'); LEGEND_STATES(:,41) = strpad('Ca_ATP2 in component razumova (micromolar)'); LEGEND_STATES(:,42) = strpad('Mg_ATP1 in component razumova (micromolar)'); LEGEND_STATES(:,43) = strpad('Mg_ATP2 in component razumova (micromolar)'); LEGEND_STATES(:,44) = strpad('ATP1 in component razumova (micromolar)'); LEGEND_STATES(:,45) = strpad('ATP2 in component razumova (micromolar)'); LEGEND_STATES(:,46) = strpad('Mg1 in component razumova (micromolar)'); LEGEND_STATES(:,47) = strpad('Mg2 in component razumova (micromolar)'); LEGEND_STATES(:,48) = strpad('Ca_CaT2 in component razumova (micromolar)'); LEGEND_STATES(:,49) = strpad('D_0 in component razumova (micromolar)'); LEGEND_STATES(:,50) = strpad('D_1 in component razumova (micromolar)'); LEGEND_STATES(:,51) = strpad('D_2 in component razumova (micromolar)'); LEGEND_STATES(:,52) = strpad('A_1 in component razumova (micromolar)'); LEGEND_STATES(:,53) = strpad('A_2 in component razumova (micromolar)'); LEGEND_STATES(:,54) = strpad('P in component razumova (milliM)'); LEGEND_STATES(:,55) = strpad('P_SR in component razumova (milliM)'); LEGEND_STATES(:,56) = strpad('P_C_SR in component razumova (milliM)'); LEGEND_CONSTANTS(:,99) = strpad('i2 in component razumova (micrometre3_per_millisecond)'); LEGEND_RATES(:,1) = strpad('d/dt vS in component wal_environment (millivolt)'); LEGEND_RATES(:,2) = strpad('d/dt vT in component wal_environment (millivolt)'); LEGEND_RATES(:,4) = strpad('d/dt K_i in component wal_environment (milliM)'); LEGEND_RATES(:,3) = strpad('d/dt K_t in component wal_environment (milliM)'); LEGEND_RATES(:,5) = strpad('d/dt K_e in component wal_environment (milliM)'); LEGEND_RATES(:,6) = strpad('d/dt Na_i in component wal_environment (milliM)'); LEGEND_RATES(:,7) = strpad('d/dt Na_t in component wal_environment (milliM)'); LEGEND_RATES(:,8) = strpad('d/dt Na_e in component wal_environment (milliM)'); LEGEND_RATES(:,9) = strpad('d/dt n in component sarco_DR_channel (dimensionless)'); LEGEND_RATES(:,10) = strpad('d/dt h_K in component sarco_DR_channel (dimensionless)'); LEGEND_RATES(:,11) = strpad('d/dt m in component sarco_Na_channel (dimensionless)'); LEGEND_RATES(:,12) = strpad('d/dt h in component sarco_Na_channel (dimensionless)'); LEGEND_RATES(:,13) = strpad('d/dt S in component sarco_Na_channel (dimensionless)'); LEGEND_RATES(:,14) = strpad('d/dt n_t in component t_DR_channel (dimensionless)'); LEGEND_RATES(:,15) = strpad('d/dt h_K_t in component t_DR_channel (dimensionless)'); LEGEND_RATES(:,16) = strpad('d/dt m_t in component t_Na_channel (dimensionless)'); LEGEND_RATES(:,17) = strpad('d/dt h_t in component t_Na_channel (dimensionless)'); LEGEND_RATES(:,18) = strpad('d/dt S_t in component t_Na_channel (dimensionless)'); LEGEND_RATES(:,24) = strpad('d/dt C_0 in component sternrios (dimensionless)'); LEGEND_RATES(:,19) = strpad('d/dt O_0 in component sternrios (dimensionless)'); LEGEND_RATES(:,25) = strpad('d/dt C_1 in component sternrios (dimensionless)'); LEGEND_RATES(:,20) = strpad('d/dt O_1 in component sternrios (dimensionless)'); LEGEND_RATES(:,26) = strpad('d/dt C_2 in component sternrios (dimensionless)'); LEGEND_RATES(:,21) = strpad('d/dt O_2 in component sternrios (dimensionless)'); LEGEND_RATES(:,27) = strpad('d/dt C_3 in component sternrios (dimensionless)'); LEGEND_RATES(:,22) = strpad('d/dt O_3 in component sternrios (dimensionless)'); LEGEND_RATES(:,28) = strpad('d/dt C_4 in component sternrios (dimensionless)'); LEGEND_RATES(:,23) = strpad('d/dt O_4 in component sternrios (dimensionless)'); LEGEND_RATES(:,29) = strpad('d/dt Ca_1 in component razumova (micromolar)'); LEGEND_RATES(:,30) = strpad('d/dt Ca_SR1 in component razumova (micromolar)'); LEGEND_RATES(:,31) = strpad('d/dt Ca_2 in component razumova (micromolar)'); LEGEND_RATES(:,32) = strpad('d/dt Ca_SR2 in component razumova (micromolar)'); LEGEND_RATES(:,33) = strpad('d/dt Ca_T_2 in component razumova (micromolar)'); LEGEND_RATES(:,34) = strpad('d/dt Ca_P1 in component razumova (micromolar)'); LEGEND_RATES(:,35) = strpad('d/dt Ca_P2 in component razumova (micromolar)'); LEGEND_RATES(:,36) = strpad('d/dt Mg_P1 in component razumova (micromolar)'); LEGEND_RATES(:,37) = strpad('d/dt Mg_P2 in component razumova (micromolar)'); LEGEND_RATES(:,38) = strpad('d/dt Ca_Cs1 in component razumova (micromolar)'); LEGEND_RATES(:,39) = strpad('d/dt Ca_Cs2 in component razumova (micromolar)'); LEGEND_RATES(:,40) = strpad('d/dt Ca_ATP1 in component razumova (micromolar)'); LEGEND_RATES(:,41) = strpad('d/dt Ca_ATP2 in component razumova (micromolar)'); LEGEND_RATES(:,42) = strpad('d/dt Mg_ATP1 in component razumova (micromolar)'); LEGEND_RATES(:,43) = strpad('d/dt Mg_ATP2 in component razumova (micromolar)'); LEGEND_RATES(:,44) = strpad('d/dt ATP1 in component razumova (micromolar)'); LEGEND_RATES(:,45) = strpad('d/dt ATP2 in component razumova (micromolar)'); LEGEND_RATES(:,46) = strpad('d/dt Mg1 in component razumova (micromolar)'); LEGEND_RATES(:,47) = strpad('d/dt Mg2 in component razumova (micromolar)'); LEGEND_RATES(:,48) = strpad('d/dt Ca_CaT2 in component razumova (micromolar)'); LEGEND_RATES(:,49) = strpad('d/dt D_0 in component razumova (micromolar)'); LEGEND_RATES(:,50) = strpad('d/dt D_1 in component razumova (micromolar)'); LEGEND_RATES(:,51) = strpad('d/dt D_2 in component razumova (micromolar)'); LEGEND_RATES(:,52) = strpad('d/dt A_1 in component razumova (micromolar)'); LEGEND_RATES(:,53) = strpad('d/dt A_2 in component razumova (micromolar)'); LEGEND_RATES(:,54) = strpad('d/dt P in component razumova (milliM)'); LEGEND_RATES(:,55) = strpad('d/dt P_SR in component razumova (milliM)'); LEGEND_RATES(:,56) = strpad('d/dt P_C_SR in component razumova (milliM)'); 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.58; CONSTANTS(:,2) = 2.79; CONSTANTS(:,3) = 150; CONSTANTS(:,4) = 0.000001; CONSTANTS(:,5) = 0.0025; CONSTANTS(:,6) = 0.0005; CONSTANTS(:,7) = 96485; CONSTANTS(:,8) = 559; CONSTANTS(:,9) = 559; CONSTANTS(:,10) = 0.00174; CONSTANTS(:,11) = 40229.885; CONSTANTS(:,12) = 40229.885; CONSTANTS(:,13) = 0.34; CONSTANTS(:,14) = -0.43; CONSTANTS(:,15) = 0.0081; CONSTANTS(:,16) = 0.288; CONSTANTS(:,17) = 0.0131; CONSTANTS(:,18) = 4.38; CONSTANTS(:,19) = 1.38; CONSTANTS(:,20) = 0.067; CONSTANTS(:,21) = -46; CONSTANTS(:,22) = -40; CONSTANTS(:,23) = -45; CONSTANTS(:,24) = 70; CONSTANTS(:,25) = -68; CONSTANTS(:,26) = -40; CONSTANTS(:,27) = 150; CONSTANTS(:,28) = 7.1; CONSTANTS(:,29) = 7.5; CONSTANTS(:,30) = 14.7; CONSTANTS(:,31) = 9; CONSTANTS(:,32) = 10; CONSTANTS(:,33) = 7; CONSTANTS(:,34) = 18; CONSTANTS(:,35) = 40; CONSTANTS(:,36) = 8314.41; CONSTANTS(:,37) = 293; CONSTANTS(:,38) = 3.275; CONSTANTS(:,39) = 10.8; CONSTANTS(:,40) = 134; CONSTANTS(:,41) = 1.85; CONSTANTS(:,42) = 0.4; CONSTANTS(:,43) = 950; CONSTANTS(:,44) = 1; CONSTANTS(:,45) = 1; CONSTANTS(:,46) = 13; CONSTANTS(:,47) = 10; CONSTANTS(:,48) = 0.0001656; CONSTANTS(:,49) = 70; STATES(:,1) = -79.974; STATES(:,2) = -80.2; STATES(:,3) = 5.9; STATES(:,4) = 150.9; STATES(:,5) = 5.9; STATES(:,6) = 12.7; STATES(:,7) = 133; STATES(:,8) = 133; CONSTANTS(:,50) = 0.1; CONSTANTS(:,51) = 1.0; CONSTANTS(:,52) = 0.45; CONSTANTS(:,53) = 0.1; CONSTANTS(:,54) = 0.1; STATES(:,9) = 0.009466; STATES(:,10) = 0.9952; STATES(:,11) = 0.0358; STATES(:,12) = 0.4981; STATES(:,13) = 0.581; STATES(:,14) = 0.009466; STATES(:,15) = 0.9952; STATES(:,16) = 0.0358; STATES(:,17) = 0.4981; STATES(:,18) = 0.581; STATES(:,19) = 0; STATES(:,20) = 0; STATES(:,21) = 0; STATES(:,22) = 0; STATES(:,23) = 0; CONSTANTS(:,55) = 0.002; CONSTANTS(:,56) = 1000; CONSTANTS(:,57) = 0.2; CONSTANTS(:,58) = 0.2; CONSTANTS(:,59) = 4.5; CONSTANTS(:,60) = -20; STATES(:,24) = 1; STATES(:,25) = 0; STATES(:,26) = 0; STATES(:,27) = 0; STATES(:,28) = 0; CONSTANTS(:,61) = 2.4375; CONSTANTS(:,62) = 1; CONSTANTS(:,63) = 0.00004; CONSTANTS(:,64) = 0.75; CONSTANTS(:,65) = 0.75; CONSTANTS(:,66) = 1.1; CONSTANTS(:,67) = 0.5; CONSTANTS(:,68) = 0.0885; CONSTANTS(:,69) = 0.115; CONSTANTS(:,70) = 140; CONSTANTS(:,71) = 0; CONSTANTS(:,72) = 0; CONSTANTS(:,73) = 1500; CONSTANTS(:,74) = 0; CONSTANTS(:,75) = 0; CONSTANTS(:,76) = 0.000004; CONSTANTS(:,77) = 0.005; CONSTANTS(:,78) = 31000; CONSTANTS(:,79) = 0.15; CONSTANTS(:,80) = 30; CONSTANTS(:,81) = 0.0015; CONSTANTS(:,82) = 0.15; CONSTANTS(:,83) = 0.375; CONSTANTS(:,84) = 1.5; CONSTANTS(:,85) = 0; CONSTANTS(:,86) = 0.15; CONSTANTS(:,87) = 0.15; CONSTANTS(:,88) = 0.05; CONSTANTS(:,89) = 0.5; CONSTANTS(:,90) = 5; CONSTANTS(:,91) = 0.08; CONSTANTS(:,92) = 0.06; CONSTANTS(:,93) = 0.04; CONSTANTS(:,94) = 0.00000394; CONSTANTS(:,95) = 0.00000362; CONSTANTS(:,96) = 1; CONSTANTS(:,97) = 0.0001; CONSTANTS(:,98) = 6; STATES(:,29) = 0.1; STATES(:,30) = 1500; STATES(:,31) = 0.1; STATES(:,32) = 1500; STATES(:,33) = 25; STATES(:,34) = 615; STATES(:,35) = 615; STATES(:,36) = 811; STATES(:,37) = 811; STATES(:,38) = 16900; STATES(:,39) = 16900; STATES(:,40) = 0.4; STATES(:,41) = 0.4; STATES(:,42) = 7200; STATES(:,43) = 7200; STATES(:,44) = 799.6; STATES(:,45) = 799.6; STATES(:,46) = 1000; STATES(:,47) = 1000; STATES(:,48) = 3; STATES(:,49) = 0.8; STATES(:,50) = 1.2; STATES(:,51) = 3; STATES(:,52) = 0.3; STATES(:,53) = 0.23; STATES(:,54) = 0.23; STATES(:,55) = 0.23; STATES(:,56) = 0.23; CONSTANTS(:,99) = 60; CONSTANTS(:,100) = 0.950000.*CONSTANTS(:,66).* pi.*power(CONSTANTS(:,67), 2.00000); CONSTANTS(:,101) = 0.0500000.*CONSTANTS(:,66).* pi.*power(CONSTANTS(:,67), 2.00000); CONSTANTS(:,102) = 0.0100000.*CONSTANTS(:,100); CONSTANTS(:,103) = 0.990000.*CONSTANTS(:,100); CONSTANTS(:,104) = 0.0100000.*CONSTANTS(:,101); CONSTANTS(:,105) = 0.990000.*CONSTANTS(:,101); if (isempty(STATES)), warning('Initial values for states not set');, end end function [RATES, ALGEBRAIC] = computeRates(VOI, STATES, CONSTANTS) global algebraicVariableCount; statesSize = size(STATES); statesColumnCount = statesSize(2); if ( statesColumnCount == 1) STATES = STATES'; ALGEBRAIC = zeros(1, algebraicVariableCount); utilOnes = 1; else statesRowCount = statesSize(1); ALGEBRAIC = zeros(statesRowCount, algebraicVariableCount); RATES = zeros(statesRowCount, statesColumnCount); utilOnes = ones(statesRowCount, 1); end RATES(:,29) = (((( ( CONSTANTS(:,99).*(STATES(:,19)+STATES(:,20)+STATES(:,21)+STATES(:,22)+STATES(:,23))).*((STATES(:,30) - STATES(:,29))./CONSTANTS(:,102)) - CONSTANTS(:,61).*((STATES(:,29)./(STATES(:,29)+CONSTANTS(:,62)))./CONSTANTS(:,102)))+ CONSTANTS(:,63).*((STATES(:,30) - STATES(:,29))./CONSTANTS(:,102)))+ - CONSTANTS(:,64).*((STATES(:,29) - STATES(:,31))./CONSTANTS(:,102)))+ - ( ( CONSTANTS(:,71).*STATES(:,29)).*((CONSTANTS(:,73)+ - STATES(:,34))+ - STATES(:,36))+ - CONSTANTS(:,72).*STATES(:,34)))+ - ( ( CONSTANTS(:,79).*STATES(:,29)).*STATES(:,44)+ - CONSTANTS(:,80).*STATES(:,40)); RATES(:,30) = ((( - ( CONSTANTS(:,99).*(STATES(:,19)+STATES(:,20)+STATES(:,21)+STATES(:,22)+STATES(:,23))).*((STATES(:,30) - STATES(:,29))./CONSTANTS(:,104))+ CONSTANTS(:,61).*((STATES(:,29)./(STATES(:,29)+CONSTANTS(:,62)))./CONSTANTS(:,104)))+ - CONSTANTS(:,63).*((STATES(:,30) - STATES(:,29))./CONSTANTS(:,104)))+ - CONSTANTS(:,65).*((STATES(:,30) - STATES(:,32))./CONSTANTS(:,104)))+ - ( ( CONSTANTS(:,76).*STATES(:,30)).*(CONSTANTS(:,78) - STATES(:,38))+ - CONSTANTS(:,77).*STATES(:,38)); RATES(:,32) = ((( CONSTANTS(:,61).*((STATES(:,31)./(STATES(:,31)+CONSTANTS(:,62)))./CONSTANTS(:,105))+ - CONSTANTS(:,63).*((STATES(:,32)+ - STATES(:,31))./CONSTANTS(:,105)))+ CONSTANTS(:,65).*((STATES(:,30)+ - STATES(:,32))./CONSTANTS(:,105)))+ - ( ( CONSTANTS(:,76).*STATES(:,32)).*(CONSTANTS(:,78)+ - STATES(:,39))+ - CONSTANTS(:,77).*STATES(:,39))) - (1000.00./1.00000).*( CONSTANTS(:,96).*( STATES(:,55).*(0.00100000./1.00000).*STATES(:,32) - CONSTANTS(:,98)).*piecewise({ STATES(:,55).*(0.00100000./1.00000).*STATES(:,32) - CONSTANTS(:,98)>0.00000, 1.00000 }, 0.00000).*(0.00100000./1.00000).*STATES(:,55).*STATES(:,32) - CONSTANTS(:,97).*STATES(:,56).*(CONSTANTS(:,98) - STATES(:,55).*(0.00100000./1.00000).*STATES(:,32)).*piecewise({CONSTANTS(:,98) - STATES(:,55).*(0.00100000./1.00000).*STATES(:,32)>0.00000, 1.00000 }, 0.00000)); RATES(:,34) = ( CONSTANTS(:,71).*STATES(:,29)).*((CONSTANTS(:,73)+ - STATES(:,34))+ - STATES(:,36))+ - CONSTANTS(:,72).*STATES(:,34); RATES(:,35) = ( CONSTANTS(:,71).*STATES(:,31)).*((CONSTANTS(:,73)+ - STATES(:,35))+ - STATES(:,37))+ - CONSTANTS(:,72).*STATES(:,35); RATES(:,36) = ( CONSTANTS(:,74).*(CONSTANTS(:,73)+ - STATES(:,34)+ - STATES(:,36))).*STATES(:,46)+ - CONSTANTS(:,75).*STATES(:,36); RATES(:,37) = ( CONSTANTS(:,74).*(CONSTANTS(:,73)+ - STATES(:,35)+ - STATES(:,37))).*STATES(:,47)+ - CONSTANTS(:,75).*STATES(:,37); RATES(:,38) = ( CONSTANTS(:,76).*STATES(:,30)).*(CONSTANTS(:,78)+ - STATES(:,38))+ - CONSTANTS(:,77).*STATES(:,38); RATES(:,39) = ( CONSTANTS(:,76).*STATES(:,32)).*(CONSTANTS(:,78)+ - STATES(:,39))+ - CONSTANTS(:,77).*STATES(:,39); RATES(:,40) = ( ( CONSTANTS(:,79).*STATES(:,29)).*STATES(:,44)+ - CONSTANTS(:,80).*STATES(:,40))+ - CONSTANTS(:,83).*((STATES(:,40)+ - STATES(:,41))./CONSTANTS(:,102)); RATES(:,41) = ( ( CONSTANTS(:,79).*STATES(:,31)).*STATES(:,45)+ - CONSTANTS(:,80).*STATES(:,41))+ CONSTANTS(:,83).*((STATES(:,40)+ - STATES(:,41))./CONSTANTS(:,103)); RATES(:,42) = ( ( CONSTANTS(:,81).*STATES(:,46)).*STATES(:,44)+ - CONSTANTS(:,82).*STATES(:,42))+ - CONSTANTS(:,83).*((STATES(:,42)+ - STATES(:,43))./CONSTANTS(:,102)); RATES(:,43) = ( ( CONSTANTS(:,81).*STATES(:,47)).*STATES(:,45)+ - CONSTANTS(:,82).*STATES(:,43))+ CONSTANTS(:,83).*((STATES(:,42)+ - STATES(:,43))./CONSTANTS(:,103)); RATES(:,44) = ( - ( ( CONSTANTS(:,79).*STATES(:,29)).*STATES(:,44)+ - CONSTANTS(:,80).*STATES(:,40))+ - ( ( CONSTANTS(:,81).*STATES(:,46)).*STATES(:,44)+ - CONSTANTS(:,82).*STATES(:,42)))+ - CONSTANTS(:,83).*((STATES(:,44)+ - STATES(:,45))./CONSTANTS(:,102)); RATES(:,45) = ( - ( ( CONSTANTS(:,79).*STATES(:,31)).*STATES(:,45)+ - CONSTANTS(:,80).*STATES(:,41))+ - ( ( CONSTANTS(:,81).*STATES(:,47)).*STATES(:,45)+ - CONSTANTS(:,82).*STATES(:,43)))+ CONSTANTS(:,83).*((STATES(:,44)+ - STATES(:,45))./CONSTANTS(:,103)); RATES(:,46) = ( - ( ( CONSTANTS(:,74).*(CONSTANTS(:,73)+ - STATES(:,34)+ - STATES(:,36))).*STATES(:,46)+ - CONSTANTS(:,75).*STATES(:,36))+ - ( ( CONSTANTS(:,81).*STATES(:,46)).*STATES(:,44)+ - CONSTANTS(:,82).*STATES(:,42)))+ - CONSTANTS(:,84).*((STATES(:,46)+ - STATES(:,47))./CONSTANTS(:,102)); RATES(:,47) = ( - ( ( CONSTANTS(:,74).*(CONSTANTS(:,73)+ - STATES(:,35)+ - STATES(:,37))).*STATES(:,47)+ - CONSTANTS(:,75).*STATES(:,37))+ - ( ( CONSTANTS(:,81).*STATES(:,47)).*STATES(:,45)+ - CONSTANTS(:,82).*STATES(:,43)))+ CONSTANTS(:,84).*((STATES(:,46)+ - STATES(:,47))./CONSTANTS(:,103)); RATES(:,48) = (( ( CONSTANTS(:,68).*STATES(:,31)).*STATES(:,33)+ - CONSTANTS(:,69).*STATES(:,48))+ - CONSTANTS(:,87).*STATES(:,48))+ CONSTANTS(:,88).*STATES(:,51); RATES(:,50) = (((( CONSTANTS(:,68).*STATES(:,31).*STATES(:,49)+ - CONSTANTS(:,69).*STATES(:,50))+ CONSTANTS(:,85).*STATES(:,33))+ - CONSTANTS(:,86).*STATES(:,50))+ ( - CONSTANTS(:,68).*STATES(:,31)).*STATES(:,50))+ CONSTANTS(:,69).*STATES(:,51); RATES(:,51) = ((((( CONSTANTS(:,68).*STATES(:,31).*STATES(:,50)+ - CONSTANTS(:,69).*STATES(:,51))+ CONSTANTS(:,87).*STATES(:,48))+ - CONSTANTS(:,88).*STATES(:,51))+ - CONSTANTS(:,89).*STATES(:,51))+ CONSTANTS(:,90).*STATES(:,52))+ CONSTANTS(:,93).*STATES(:,53); RATES(:,52) = (( CONSTANTS(:,89).*STATES(:,51)+ - CONSTANTS(:,90).*STATES(:,52))+ CONSTANTS(:,92).*STATES(:,53))+ - CONSTANTS(:,91).*STATES(:,52); RATES(:,53) = ( - CONSTANTS(:,92).*STATES(:,53)+ CONSTANTS(:,91).*STATES(:,52))+ - CONSTANTS(:,93).*STATES(:,53); RATES(:,54) = (0.00100000./1.00000).*( CONSTANTS(:,91).*STATES(:,52) - CONSTANTS(:,92).*STATES(:,53))+ -1.00000.*CONSTANTS(:,94).*STATES(:,54)+ -1.00000.*CONSTANTS(:,95).*((STATES(:,54) - STATES(:,55))./CONSTANTS(:,103)); RATES(:,55) = CONSTANTS(:,95).*((STATES(:,54) - STATES(:,55))./CONSTANTS(:,105)) - 1.00000.*( CONSTANTS(:,96).*( STATES(:,55).*(0.00100000./1.00000).*STATES(:,32) - CONSTANTS(:,98)).*piecewise({ STATES(:,55).*(0.00100000./1.00000).*STATES(:,32) - CONSTANTS(:,98)>0.00000, 1.00000 }, 0.00000).*(0.00100000./1.00000).*STATES(:,55).*STATES(:,32) - CONSTANTS(:,97).*STATES(:,56).*(CONSTANTS(:,98) - STATES(:,55).*(0.00100000./1.00000).*STATES(:,32)).*piecewise({CONSTANTS(:,98) - STATES(:,55).*(0.00100000./1.00000).*STATES(:,32)>0.00000, 1.00000 }, 0.00000)); RATES(:,56) = 1.00000.*( CONSTANTS(:,96).*( STATES(:,55).*(0.00100000./1.00000).*STATES(:,32) - CONSTANTS(:,98)).*piecewise({ STATES(:,55).*(0.00100000./1.00000).*STATES(:,32) - CONSTANTS(:,98)>0.00000, 1.00000 }, 0.00000).*(0.00100000./1.00000).*STATES(:,55).*STATES(:,32) - CONSTANTS(:,97).*STATES(:,56).*(CONSTANTS(:,98) - STATES(:,55).*(0.00100000./1.00000).*STATES(:,32)).*piecewise({CONSTANTS(:,98) - STATES(:,55).*(0.00100000./1.00000).*STATES(:,32)>0.00000, 1.00000 }, 0.00000)); ALGEBRAIC(:,13) = CONSTANTS(:,70)+ - STATES(:,33)+ - STATES(:,48)+ - STATES(:,49)+ - STATES(:,50)+ - STATES(:,51)+ - STATES(:,52)+ - STATES(:,53); RATES(:,31) = (((( - CONSTANTS(:,61).*((STATES(:,31)./(STATES(:,31)+CONSTANTS(:,62)))./CONSTANTS(:,103))+ CONSTANTS(:,63).*((STATES(:,32)+ - STATES(:,31))./CONSTANTS(:,103)))+ CONSTANTS(:,64).*((STATES(:,29) - STATES(:,31))./CONSTANTS(:,103)))+ - ((((((( CONSTANTS(:,68).*STATES(:,31).*ALGEBRAIC(:,13)+ - CONSTANTS(:,69).*STATES(:,33))+ CONSTANTS(:,68).*STATES(:,31).*STATES(:,33))+ - CONSTANTS(:,69).*STATES(:,48))+ CONSTANTS(:,68).*STATES(:,31).*STATES(:,49))+ - CONSTANTS(:,69).*STATES(:,50))+ CONSTANTS(:,68).*STATES(:,31).*STATES(:,50))+ - CONSTANTS(:,69).*STATES(:,51)))+ - ( ( CONSTANTS(:,71).*STATES(:,31)).*(CONSTANTS(:,73)+ - STATES(:,35)+ - STATES(:,37))+ - CONSTANTS(:,72).*STATES(:,35)))+ - ( ( CONSTANTS(:,79).*STATES(:,31)).*STATES(:,45)+ - CONSTANTS(:,80).*STATES(:,41)); RATES(:,33) = (((( ( CONSTANTS(:,68).*STATES(:,31)).*ALGEBRAIC(:,13)+ - CONSTANTS(:,69).*STATES(:,33))+ ( - CONSTANTS(:,68).*STATES(:,31)).*STATES(:,33))+ CONSTANTS(:,69).*STATES(:,48))+ - CONSTANTS(:,85).*STATES(:,33))+ CONSTANTS(:,86).*STATES(:,50); RATES(:,49) = (( ( - CONSTANTS(:,68).*STATES(:,31)).*STATES(:,49)+ CONSTANTS(:,69).*STATES(:,50))+ CONSTANTS(:,85).*ALGEBRAIC(:,13))+ - CONSTANTS(:,86).*STATES(:,49); ALGEBRAIC(:,2) = CONSTANTS(:,17).*((STATES(:,1) - CONSTANTS(:,22))./(1.00000 - exp( - ((STATES(:,1) - CONSTANTS(:,22))./CONSTANTS(:,33))))); ALGEBRAIC(:,15) = CONSTANTS(:,20).*exp( - ((STATES(:,1) - CONSTANTS(:,22))./CONSTANTS(:,35))); RATES(:,9) = ALGEBRAIC(:,2).*(1.00000 - STATES(:,9)) - ALGEBRAIC(:,15).*STATES(:,9); ALGEBRAIC(:,3) = 1.00000./(1.00000+exp((STATES(:,1) - CONSTANTS(:,26))./CONSTANTS(:,29))); ALGEBRAIC(:,16) = 1000.00.*exp( - ((STATES(:,1)+40.0000)./25.7500)); RATES(:,10) = (ALGEBRAIC(:,3) - STATES(:,10))./ALGEBRAIC(:,16); ALGEBRAIC(:,5) = CONSTANTS(:,16).*((STATES(:,1) - CONSTANTS(:,21))./(1.00000 - exp( - ((STATES(:,1) - CONSTANTS(:,21))./CONSTANTS(:,32))))); ALGEBRAIC(:,18) = CONSTANTS(:,19).*exp( - ((STATES(:,1) - CONSTANTS(:,21))./CONSTANTS(:,34))); RATES(:,11) = ALGEBRAIC(:,5).*(1.00000 - STATES(:,11)) - ALGEBRAIC(:,18).*STATES(:,11); ALGEBRAIC(:,4) = CONSTANTS(:,15).*exp( - ((STATES(:,1) - CONSTANTS(:,23))./CONSTANTS(:,30))); ALGEBRAIC(:,17) = CONSTANTS(:,18)./(1.00000+exp( - ((STATES(:,1) - CONSTANTS(:,23))./CONSTANTS(:,31)))); RATES(:,12) = ALGEBRAIC(:,4).*(1.00000 - STATES(:,12)) - ALGEBRAIC(:,17).*STATES(:,12); ALGEBRAIC(:,6) = 1.00000./(1.00000+exp((STATES(:,1) - CONSTANTS(:,25))./CONSTANTS(:,28))); ALGEBRAIC(:,19) = 8571.00./(0.200000+ 5.65000.*power((STATES(:,1)+CONSTANTS(:,49))./100.000, 2.00000)); RATES(:,13) = (ALGEBRAIC(:,6) - STATES(:,13))./ALGEBRAIC(:,19); ALGEBRAIC(:,7) = CONSTANTS(:,17).*((STATES(:,2) - CONSTANTS(:,22))./(1.00000 - exp( - ((STATES(:,2) - CONSTANTS(:,22))./CONSTANTS(:,33))))); ALGEBRAIC(:,20) = CONSTANTS(:,20).*exp( - ((STATES(:,2) - CONSTANTS(:,22))./CONSTANTS(:,35))); RATES(:,14) = ALGEBRAIC(:,7).*(1.00000 - STATES(:,14)) - ALGEBRAIC(:,20).*STATES(:,14); ALGEBRAIC(:,8) = 1.00000./(1.00000+exp((STATES(:,2) - CONSTANTS(:,26))./CONSTANTS(:,29))); ALGEBRAIC(:,21) = 1.00000.*exp( - ((STATES(:,2)+40.0000)./25.7500)); RATES(:,15) = (ALGEBRAIC(:,8) - STATES(:,15))./ALGEBRAIC(:,21); ALGEBRAIC(:,10) = CONSTANTS(:,16).*((STATES(:,2) - CONSTANTS(:,21))./(1.00000 - exp( - ((STATES(:,2) - CONSTANTS(:,21))./CONSTANTS(:,32))))); ALGEBRAIC(:,23) = CONSTANTS(:,19).*exp( - ((STATES(:,2) - CONSTANTS(:,21))./CONSTANTS(:,34))); RATES(:,16) = ALGEBRAIC(:,10).*(1.00000 - STATES(:,16)) - ALGEBRAIC(:,23).*STATES(:,16); ALGEBRAIC(:,9) = CONSTANTS(:,15).*exp( - ((STATES(:,2) - CONSTANTS(:,23))./CONSTANTS(:,30))); ALGEBRAIC(:,22) = CONSTANTS(:,18)./(1.00000+exp( - ((STATES(:,2) - CONSTANTS(:,23))./CONSTANTS(:,31)))); RATES(:,17) = ALGEBRAIC(:,9).*(1.00000 - STATES(:,17)) - ALGEBRAIC(:,22).*STATES(:,17); ALGEBRAIC(:,11) = 1.00000./(1.00000+exp((STATES(:,2) - CONSTANTS(:,25))./CONSTANTS(:,28))); ALGEBRAIC(:,24) = 8571.00./(0.200000+ 5.65000.*power((STATES(:,2)+CONSTANTS(:,49))./100.000, 2.00000)); RATES(:,18) = (ALGEBRAIC(:,11) - STATES(:,18))./ALGEBRAIC(:,24); ALGEBRAIC(:,12) = 0.500000.*CONSTANTS(:,58).*exp((STATES(:,2) - CONSTANTS(:,60))./( 8.00000.*CONSTANTS(:,59))); ALGEBRAIC(:,25) = 0.500000.*CONSTANTS(:,58).*exp((CONSTANTS(:,60) - STATES(:,2))./( 8.00000.*CONSTANTS(:,59))); RATES(:,24) = - CONSTANTS(:,55).*STATES(:,24)+ CONSTANTS(:,56).*STATES(:,19)+ -4.00000.*ALGEBRAIC(:,12).*STATES(:,24)+ ALGEBRAIC(:,25).*STATES(:,25); RATES(:,19) = CONSTANTS(:,55).*STATES(:,24)+ - CONSTANTS(:,56).*STATES(:,19)+( -4.00000.*ALGEBRAIC(:,12).*STATES(:,19))./CONSTANTS(:,57)+ CONSTANTS(:,57).*ALGEBRAIC(:,25).*STATES(:,20); RATES(:,25) = 4.00000.*ALGEBRAIC(:,12).*STATES(:,24)+ - ALGEBRAIC(:,25).*STATES(:,25)+( - CONSTANTS(:,55).*STATES(:,25))./CONSTANTS(:,57)+ CONSTANTS(:,57).*CONSTANTS(:,56).*STATES(:,20)+ -3.00000.*ALGEBRAIC(:,12).*STATES(:,25)+ 2.00000.*ALGEBRAIC(:,25).*STATES(:,26); RATES(:,20) = ( CONSTANTS(:,55).*STATES(:,25))./CONSTANTS(:,57)+ - CONSTANTS(:,56).*CONSTANTS(:,57).*STATES(:,20)+( 4.00000.*ALGEBRAIC(:,12).*STATES(:,19))./CONSTANTS(:,57)+ - CONSTANTS(:,57).*ALGEBRAIC(:,25).*STATES(:,20)+( -3.00000.*ALGEBRAIC(:,12).*STATES(:,20))./CONSTANTS(:,57)+ 2.00000.*CONSTANTS(:,57).*ALGEBRAIC(:,25).*STATES(:,21); RATES(:,26) = 3.00000.*ALGEBRAIC(:,12).*STATES(:,25)+ -2.00000.*ALGEBRAIC(:,25).*STATES(:,26)+( - CONSTANTS(:,55).*STATES(:,26))./power(CONSTANTS(:,57), 2.00000)+ power(CONSTANTS(:,57), 2.00000).*CONSTANTS(:,56).*STATES(:,21)+ -2.00000.*ALGEBRAIC(:,12).*STATES(:,26)+ 3.00000.*ALGEBRAIC(:,25).*STATES(:,27); RATES(:,21) = ( 3.00000.*ALGEBRAIC(:,12).*STATES(:,20))./CONSTANTS(:,57)+ -2.00000.*CONSTANTS(:,57).*ALGEBRAIC(:,25).*STATES(:,21)+( CONSTANTS(:,55).*STATES(:,26))./power(CONSTANTS(:,57), 2.00000)+ - CONSTANTS(:,56).*power(CONSTANTS(:,57), 2.00000).*STATES(:,21)+( -2.00000.*ALGEBRAIC(:,12).*STATES(:,21))./CONSTANTS(:,57)+ 3.00000.*CONSTANTS(:,57).*ALGEBRAIC(:,25).*STATES(:,22); RATES(:,27) = 2.00000.*ALGEBRAIC(:,12).*STATES(:,26)+ -3.00000.*ALGEBRAIC(:,25).*STATES(:,27)+( - CONSTANTS(:,55).*STATES(:,27))./power(CONSTANTS(:,57), 3.00000)+ CONSTANTS(:,56).*power(CONSTANTS(:,57), 3.00000).*STATES(:,22)+ - ALGEBRAIC(:,12).*STATES(:,27)+ 4.00000.*ALGEBRAIC(:,25).*STATES(:,28); RATES(:,22) = ( CONSTANTS(:,55).*STATES(:,27))./power(CONSTANTS(:,57), 3.00000)+ - CONSTANTS(:,56).*power(CONSTANTS(:,57), 3.00000).*STATES(:,22)+( 2.00000.*ALGEBRAIC(:,12).*STATES(:,21))./CONSTANTS(:,57)+ -3.00000.*ALGEBRAIC(:,25).*CONSTANTS(:,57).*STATES(:,22)+( - ALGEBRAIC(:,12).*STATES(:,22))./CONSTANTS(:,57)+ 4.00000.*CONSTANTS(:,57).*ALGEBRAIC(:,25).*STATES(:,23); RATES(:,28) = ALGEBRAIC(:,12).*STATES(:,27)+ -4.00000.*ALGEBRAIC(:,25).*STATES(:,28)+( - CONSTANTS(:,55).*STATES(:,28))./power(CONSTANTS(:,57), 4.00000)+ CONSTANTS(:,56).*power(CONSTANTS(:,57), 4.00000).*STATES(:,23); RATES(:,23) = ( ALGEBRAIC(:,12).*STATES(:,22))./CONSTANTS(:,57)+ -4.00000.*CONSTANTS(:,57).*ALGEBRAIC(:,25).*STATES(:,23)+( CONSTANTS(:,55).*STATES(:,28))./power(CONSTANTS(:,57), 4.00000)+ - CONSTANTS(:,56).*power(CONSTANTS(:,57), 4.00000).*STATES(:,23); ALGEBRAIC(:,31) = STATES(:,1).*((STATES(:,4) - STATES(:,5).*exp(( -1.00000.*CONSTANTS(:,7).*STATES(:,1))./( CONSTANTS(:,36).*CONSTANTS(:,37))))./(1.00000 - exp(( -1.00000.*CONSTANTS(:,7).*STATES(:,1))./( CONSTANTS(:,36).*CONSTANTS(:,37))))); ALGEBRAIC(:,14) = (( CONSTANTS(:,36).*CONSTANTS(:,37))./CONSTANTS(:,7)).*log(STATES(:,5)./STATES(:,4)); ALGEBRAIC(:,38) = STATES(:,5).*exp( ( - CONSTANTS(:,42).*ALGEBRAIC(:,14)).*(CONSTANTS(:,7)./( CONSTANTS(:,36).*CONSTANTS(:,37)))); ALGEBRAIC(:,39) = CONSTANTS(:,41).*(power(ALGEBRAIC(:,38), 2.00000)./(CONSTANTS(:,43)+power(ALGEBRAIC(:,38), 2.00000))); ALGEBRAIC(:,40) = 1.00000 - power(1.00000+( CONSTANTS(:,44).*(1.00000+power(ALGEBRAIC(:,38), 2.00000)./CONSTANTS(:,43)))./( power(CONSTANTS(:,47), 2.00000).*exp(( 2.00000.*(1.00000 - CONSTANTS(:,42)).*STATES(:,1).*CONSTANTS(:,7))./( CONSTANTS(:,36).*CONSTANTS(:,37)))), -1.00000); ALGEBRAIC(:,41) = ALGEBRAIC(:,39).*ALGEBRAIC(:,40); ALGEBRAIC(:,42) = ALGEBRAIC(:,41).*piecewise({ALGEBRAIC(:,31)>0.00000, 1.00000 }, 0.00000).*(ALGEBRAIC(:,31)./50.0000); ALGEBRAIC(:,43) = ( CONSTANTS(:,39).*power(STATES(:,9), 4.00000)).*STATES(:,10); ALGEBRAIC(:,44) = ALGEBRAIC(:,43).*(ALGEBRAIC(:,31)./50.0000); ALGEBRAIC(:,48) = (1.00000./7.00000).*(exp(STATES(:,8)./67.3000) - 1.00000); ALGEBRAIC(:,49) = power(1.00000+ 0.120000.*exp( -0.100000.*STATES(:,1).*(CONSTANTS(:,7)./( CONSTANTS(:,36).*CONSTANTS(:,37))))+ 0.0400000.*ALGEBRAIC(:,48).*exp( - ( STATES(:,1).*(CONSTANTS(:,7)./( CONSTANTS(:,36).*CONSTANTS(:,37))))), -1.00000); ALGEBRAIC(:,50) = CONSTANTS(:,7).*(CONSTANTS(:,48)./( power(1.00000+CONSTANTS(:,45)./STATES(:,5), 2.00000).*power(1.00000+CONSTANTS(:,46)./STATES(:,6), 3.00000))); ALGEBRAIC(:,51) = ALGEBRAIC(:,50).*ALGEBRAIC(:,49); RATES(:,5) = (ALGEBRAIC(:,42)+ALGEBRAIC(:,44)+CONSTANTS(:,13)+ - 2.00000.*ALGEBRAIC(:,51))./( (1000.00./1.00000).*CONSTANTS(:,7).*CONSTANTS(:,6))+(STATES(:,3) - STATES(:,5))./CONSTANTS(:,11); ALGEBRAIC(:,46) = ( ( CONSTANTS(:,40).*power(STATES(:,11), 3.00000)).*STATES(:,12)).*STATES(:,13); ALGEBRAIC(:,45) = STATES(:,1).*((STATES(:,6) - STATES(:,8).*exp(( -1.00000.*CONSTANTS(:,7).*STATES(:,1))./( CONSTANTS(:,36).*CONSTANTS(:,37))))./(1.00000 - exp(( -1.00000.*CONSTANTS(:,7).*STATES(:,1))./( CONSTANTS(:,36).*CONSTANTS(:,37))))); ALGEBRAIC(:,47) = ALGEBRAIC(:,46).*(ALGEBRAIC(:,45)./75.0000); RATES(:,8) = (ALGEBRAIC(:,47)+CONSTANTS(:,14)+ 3.00000.*ALGEBRAIC(:,51))./( (1000.00./1.00000).*CONSTANTS(:,7).*CONSTANTS(:,6))+(STATES(:,7) - STATES(:,8))./CONSTANTS(:,12); ALGEBRAIC(:,1) = (1000.00./1.00000).*((STATES(:,1) - STATES(:,2))./CONSTANTS(:,3)); ALGEBRAIC(:,27) = 156.500./(5.00000+exp(( - CONSTANTS(:,7).*ALGEBRAIC(:,14))./( CONSTANTS(:,36).*CONSTANTS(:,37)))); ALGEBRAIC(:,28) = 156.500 - 5.00000.*ALGEBRAIC(:,27); ALGEBRAIC(:,35) = STATES(:,1).*((ALGEBRAIC(:,27) - ALGEBRAIC(:,28).*exp(( CONSTANTS(:,7).*STATES(:,1))./( CONSTANTS(:,36).*CONSTANTS(:,37))))./(1.00000 - exp(( CONSTANTS(:,7).*STATES(:,1))./( CONSTANTS(:,36).*CONSTANTS(:,37))))); ALGEBRAIC(:,34) = 1.00000./(1.00000+exp((STATES(:,1) - CONSTANTS(:,24))./CONSTANTS(:,27))); ALGEBRAIC(:,36) = CONSTANTS(:,38).*power(ALGEBRAIC(:,34), 4.00000); ALGEBRAIC(:,37) = ALGEBRAIC(:,36).*(ALGEBRAIC(:,35)./45.0000); ALGEBRAIC(:,33) = piecewise({VOI>=0.00000&VOI<0.500000, 150.000 , VOI>=50.0000&VOI<50.5000, 150.000 , VOI>=100.000&VOI<100.500, 150.000 , VOI>=150.000&VOI<150.500, 150.000 , VOI>=200.000&VOI<200.500, 150.000 , VOI>=250.000&VOI<250.500, 150.000 , VOI>=300.000&VOI<300.500, 150.000 , VOI>=350.000&VOI<350.500, 150.000 , VOI>=400.000&VOI<400.500, 150.000 }, 0.00000); ALGEBRAIC(:,52) = ALGEBRAIC(:,37)+ALGEBRAIC(:,42)+ALGEBRAIC(:,44)+ALGEBRAIC(:,47)+ALGEBRAIC(:,51)+ - ALGEBRAIC(:,33); RATES(:,1) = - ((ALGEBRAIC(:,52)+ALGEBRAIC(:,1))./CONSTANTS(:,1)); ALGEBRAIC(:,32) = STATES(:,2).*((STATES(:,4) - STATES(:,3).*exp(( -1.00000.*CONSTANTS(:,7).*STATES(:,2))./( CONSTANTS(:,36).*CONSTANTS(:,37))))./(1.00000 - exp(( -1.00000.*CONSTANTS(:,7).*STATES(:,2))./( CONSTANTS(:,36).*CONSTANTS(:,37))))); ALGEBRAIC(:,26) = (( CONSTANTS(:,36).*CONSTANTS(:,37))./CONSTANTS(:,7)).*log(STATES(:,3)./STATES(:,4)); ALGEBRAIC(:,57) = STATES(:,3).*exp( ( - CONSTANTS(:,42).*ALGEBRAIC(:,26)).*(CONSTANTS(:,7)./( CONSTANTS(:,36).*CONSTANTS(:,37)))); ALGEBRAIC(:,58) = CONSTANTS(:,41).*(power(ALGEBRAIC(:,57), 2.00000)./(CONSTANTS(:,43)+power(ALGEBRAIC(:,57), 2.00000))); ALGEBRAIC(:,59) = 1.00000 - power(1.00000+( CONSTANTS(:,44).*(1.00000+power(ALGEBRAIC(:,57), 2.00000)./CONSTANTS(:,43)))./( power(CONSTANTS(:,47), 2.00000).*exp(( 2.00000.*(1.00000 - CONSTANTS(:,42)).*STATES(:,2).*CONSTANTS(:,7))./( CONSTANTS(:,36).*CONSTANTS(:,37)))), -1.00000); ALGEBRAIC(:,60) = ALGEBRAIC(:,58).*ALGEBRAIC(:,59); ALGEBRAIC(:,61) = CONSTANTS(:,51).*ALGEBRAIC(:,60).*(ALGEBRAIC(:,32)./50.0000); ALGEBRAIC(:,62) = ( CONSTANTS(:,39).*power(STATES(:,14), 4.00000)).*STATES(:,15); ALGEBRAIC(:,63) = CONSTANTS(:,52).*ALGEBRAIC(:,62).*(ALGEBRAIC(:,32)./50.0000); ALGEBRAIC(:,67) = (1.00000./7.00000).*(exp(STATES(:,7)./67.3000) - 1.00000); ALGEBRAIC(:,68) = power(1.00000+ 0.120000.*exp( -0.100000.*STATES(:,2).*(CONSTANTS(:,7)./( CONSTANTS(:,36).*CONSTANTS(:,37))))+ 0.0400000.*ALGEBRAIC(:,67).*exp( - ( STATES(:,2).*(CONSTANTS(:,7)./( CONSTANTS(:,36).*CONSTANTS(:,37))))), -1.00000); ALGEBRAIC(:,69) = CONSTANTS(:,7).*(CONSTANTS(:,48)./( power(1.00000+CONSTANTS(:,45)./STATES(:,3), 2.00000).*power(1.00000+CONSTANTS(:,46)./STATES(:,6), 3.00000))); ALGEBRAIC(:,70) = CONSTANTS(:,54).*ALGEBRAIC(:,69).*ALGEBRAIC(:,68); RATES(:,4) = - CONSTANTS(:,10).*((ALGEBRAIC(:,61)+ALGEBRAIC(:,63)+CONSTANTS(:,13)+ - 2.00000.*ALGEBRAIC(:,70))./( (1000.00./1.00000).*CONSTANTS(:,7).*CONSTANTS(:,4))) - (ALGEBRAIC(:,42)+ALGEBRAIC(:,44)+CONSTANTS(:,13)+ -2.00000.*ALGEBRAIC(:,51))./( (1000.00./1.00000).*CONSTANTS(:,7).*CONSTANTS(:,5)); RATES(:,3) = (ALGEBRAIC(:,61)+ALGEBRAIC(:,63)+CONSTANTS(:,13)+ - 2.00000.*ALGEBRAIC(:,70))./( (1000.00./1.00000).*CONSTANTS(:,7).*CONSTANTS(:,4)) - (STATES(:,3) - STATES(:,5))./CONSTANTS(:,8); ALGEBRAIC(:,65) = ( ( CONSTANTS(:,40).*power(STATES(:,16), 3.00000)).*STATES(:,17)).*STATES(:,18); ALGEBRAIC(:,64) = STATES(:,2).*((STATES(:,6) - STATES(:,7).*exp(( -1.00000.*CONSTANTS(:,7).*STATES(:,2))./( CONSTANTS(:,36).*CONSTANTS(:,37))))./(1.00000 - exp(( -1.00000.*CONSTANTS(:,7).*STATES(:,2))./( CONSTANTS(:,36).*CONSTANTS(:,37))))); ALGEBRAIC(:,66) = CONSTANTS(:,53).*ALGEBRAIC(:,65).*(ALGEBRAIC(:,64)./75.0000); RATES(:,6) = - CONSTANTS(:,10).*((ALGEBRAIC(:,66)+CONSTANTS(:,14)+ 3.00000.*ALGEBRAIC(:,70))./( (1000.00./1.00000).*CONSTANTS(:,7).*CONSTANTS(:,4))) - (ALGEBRAIC(:,47)+CONSTANTS(:,14)+ 3.00000.*ALGEBRAIC(:,51))./( (1000.00./1.00000).*CONSTANTS(:,7).*CONSTANTS(:,5)); RATES(:,7) = (ALGEBRAIC(:,66)+CONSTANTS(:,14)+ 3.00000.*ALGEBRAIC(:,70))./( (1000.00./1.00000).*CONSTANTS(:,7).*CONSTANTS(:,4)) - (STATES(:,7) - STATES(:,8))./CONSTANTS(:,9); ALGEBRAIC(:,29) = 156.500./(5.00000+exp(( - CONSTANTS(:,7).*ALGEBRAIC(:,26))./( CONSTANTS(:,36).*CONSTANTS(:,37)))); ALGEBRAIC(:,30) = 156.500 - 5.00000.*ALGEBRAIC(:,29); ALGEBRAIC(:,54) = STATES(:,2).*((ALGEBRAIC(:,29) - ALGEBRAIC(:,30).*exp(( CONSTANTS(:,7).*STATES(:,2))./( CONSTANTS(:,36).*CONSTANTS(:,37))))./(1.00000 - exp(( CONSTANTS(:,7).*STATES(:,2))./( CONSTANTS(:,36).*CONSTANTS(:,37))))); ALGEBRAIC(:,53) = 1.00000./(1.00000+exp((STATES(:,2) - CONSTANTS(:,24))./CONSTANTS(:,27))); ALGEBRAIC(:,55) = CONSTANTS(:,38).*power(ALGEBRAIC(:,53), 4.00000); ALGEBRAIC(:,56) = CONSTANTS(:,50).*ALGEBRAIC(:,55).*(ALGEBRAIC(:,54)./45.0000); ALGEBRAIC(:,71) = ALGEBRAIC(:,56)+ALGEBRAIC(:,61)+ALGEBRAIC(:,63)+ALGEBRAIC(:,66)+ALGEBRAIC(:,70); RATES(:,2) = - ((ALGEBRAIC(:,71) - ALGEBRAIC(:,1)./CONSTANTS(:,2))./CONSTANTS(:,1)); 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(:,13) = CONSTANTS(:,70)+ - STATES(:,33)+ - STATES(:,48)+ - STATES(:,49)+ - STATES(:,50)+ - STATES(:,51)+ - STATES(:,52)+ - STATES(:,53); ALGEBRAIC(:,2) = CONSTANTS(:,17).*((STATES(:,1) - CONSTANTS(:,22))./(1.00000 - exp( - ((STATES(:,1) - CONSTANTS(:,22))./CONSTANTS(:,33))))); ALGEBRAIC(:,15) = CONSTANTS(:,20).*exp( - ((STATES(:,1) - CONSTANTS(:,22))./CONSTANTS(:,35))); ALGEBRAIC(:,3) = 1.00000./(1.00000+exp((STATES(:,1) - CONSTANTS(:,26))./CONSTANTS(:,29))); ALGEBRAIC(:,16) = 1000.00.*exp( - ((STATES(:,1)+40.0000)./25.7500)); ALGEBRAIC(:,5) = CONSTANTS(:,16).*((STATES(:,1) - CONSTANTS(:,21))./(1.00000 - exp( - ((STATES(:,1) - CONSTANTS(:,21))./CONSTANTS(:,32))))); ALGEBRAIC(:,18) = CONSTANTS(:,19).*exp( - ((STATES(:,1) - CONSTANTS(:,21))./CONSTANTS(:,34))); ALGEBRAIC(:,4) = CONSTANTS(:,15).*exp( - ((STATES(:,1) - CONSTANTS(:,23))./CONSTANTS(:,30))); ALGEBRAIC(:,17) = CONSTANTS(:,18)./(1.00000+exp( - ((STATES(:,1) - CONSTANTS(:,23))./CONSTANTS(:,31)))); ALGEBRAIC(:,6) = 1.00000./(1.00000+exp((STATES(:,1) - CONSTANTS(:,25))./CONSTANTS(:,28))); ALGEBRAIC(:,19) = 8571.00./(0.200000+ 5.65000.*power((STATES(:,1)+CONSTANTS(:,49))./100.000, 2.00000)); ALGEBRAIC(:,7) = CONSTANTS(:,17).*((STATES(:,2) - CONSTANTS(:,22))./(1.00000 - exp( - ((STATES(:,2) - CONSTANTS(:,22))./CONSTANTS(:,33))))); ALGEBRAIC(:,20) = CONSTANTS(:,20).*exp( - ((STATES(:,2) - CONSTANTS(:,22))./CONSTANTS(:,35))); ALGEBRAIC(:,8) = 1.00000./(1.00000+exp((STATES(:,2) - CONSTANTS(:,26))./CONSTANTS(:,29))); ALGEBRAIC(:,21) = 1.00000.*exp( - ((STATES(:,2)+40.0000)./25.7500)); ALGEBRAIC(:,10) = CONSTANTS(:,16).*((STATES(:,2) - CONSTANTS(:,21))./(1.00000 - exp( - ((STATES(:,2) - CONSTANTS(:,21))./CONSTANTS(:,32))))); ALGEBRAIC(:,23) = CONSTANTS(:,19).*exp( - ((STATES(:,2) - CONSTANTS(:,21))./CONSTANTS(:,34))); ALGEBRAIC(:,9) = CONSTANTS(:,15).*exp( - ((STATES(:,2) - CONSTANTS(:,23))./CONSTANTS(:,30))); ALGEBRAIC(:,22) = CONSTANTS(:,18)./(1.00000+exp( - ((STATES(:,2) - CONSTANTS(:,23))./CONSTANTS(:,31)))); ALGEBRAIC(:,11) = 1.00000./(1.00000+exp((STATES(:,2) - CONSTANTS(:,25))./CONSTANTS(:,28))); ALGEBRAIC(:,24) = 8571.00./(0.200000+ 5.65000.*power((STATES(:,2)+CONSTANTS(:,49))./100.000, 2.00000)); ALGEBRAIC(:,12) = 0.500000.*CONSTANTS(:,58).*exp((STATES(:,2) - CONSTANTS(:,60))./( 8.00000.*CONSTANTS(:,59))); ALGEBRAIC(:,25) = 0.500000.*CONSTANTS(:,58).*exp((CONSTANTS(:,60) - STATES(:,2))./( 8.00000.*CONSTANTS(:,59))); ALGEBRAIC(:,31) = STATES(:,1).*((STATES(:,4) - STATES(:,5).*exp(( -1.00000.*CONSTANTS(:,7).*STATES(:,1))./( CONSTANTS(:,36).*CONSTANTS(:,37))))./(1.00000 - exp(( -1.00000.*CONSTANTS(:,7).*STATES(:,1))./( CONSTANTS(:,36).*CONSTANTS(:,37))))); ALGEBRAIC(:,14) = (( CONSTANTS(:,36).*CONSTANTS(:,37))./CONSTANTS(:,7)).*log(STATES(:,5)./STATES(:,4)); ALGEBRAIC(:,38) = STATES(:,5).*exp( ( - CONSTANTS(:,42).*ALGEBRAIC(:,14)).*(CONSTANTS(:,7)./( CONSTANTS(:,36).*CONSTANTS(:,37)))); ALGEBRAIC(:,39) = CONSTANTS(:,41).*(power(ALGEBRAIC(:,38), 2.00000)./(CONSTANTS(:,43)+power(ALGEBRAIC(:,38), 2.00000))); ALGEBRAIC(:,40) = 1.00000 - power(1.00000+( CONSTANTS(:,44).*(1.00000+power(ALGEBRAIC(:,38), 2.00000)./CONSTANTS(:,43)))./( power(CONSTANTS(:,47), 2.00000).*exp(( 2.00000.*(1.00000 - CONSTANTS(:,42)).*STATES(:,1).*CONSTANTS(:,7))./( CONSTANTS(:,36).*CONSTANTS(:,37)))), -1.00000); ALGEBRAIC(:,41) = ALGEBRAIC(:,39).*ALGEBRAIC(:,40); ALGEBRAIC(:,42) = ALGEBRAIC(:,41).*piecewise({ALGEBRAIC(:,31)>0.00000, 1.00000 }, 0.00000).*(ALGEBRAIC(:,31)./50.0000); ALGEBRAIC(:,43) = ( CONSTANTS(:,39).*power(STATES(:,9), 4.00000)).*STATES(:,10); ALGEBRAIC(:,44) = ALGEBRAIC(:,43).*(ALGEBRAIC(:,31)./50.0000); ALGEBRAIC(:,48) = (1.00000./7.00000).*(exp(STATES(:,8)./67.3000) - 1.00000); ALGEBRAIC(:,49) = power(1.00000+ 0.120000.*exp( -0.100000.*STATES(:,1).*(CONSTANTS(:,7)./( CONSTANTS(:,36).*CONSTANTS(:,37))))+ 0.0400000.*ALGEBRAIC(:,48).*exp( - ( STATES(:,1).*(CONSTANTS(:,7)./( CONSTANTS(:,36).*CONSTANTS(:,37))))), -1.00000); ALGEBRAIC(:,50) = CONSTANTS(:,7).*(CONSTANTS(:,48)./( power(1.00000+CONSTANTS(:,45)./STATES(:,5), 2.00000).*power(1.00000+CONSTANTS(:,46)./STATES(:,6), 3.00000))); ALGEBRAIC(:,51) = ALGEBRAIC(:,50).*ALGEBRAIC(:,49); ALGEBRAIC(:,46) = ( ( CONSTANTS(:,40).*power(STATES(:,11), 3.00000)).*STATES(:,12)).*STATES(:,13); ALGEBRAIC(:,45) = STATES(:,1).*((STATES(:,6) - STATES(:,8).*exp(( -1.00000.*CONSTANTS(:,7).*STATES(:,1))./( CONSTANTS(:,36).*CONSTANTS(:,37))))./(1.00000 - exp(( -1.00000.*CONSTANTS(:,7).*STATES(:,1))./( CONSTANTS(:,36).*CONSTANTS(:,37))))); ALGEBRAIC(:,47) = ALGEBRAIC(:,46).*(ALGEBRAIC(:,45)./75.0000); ALGEBRAIC(:,1) = (1000.00./1.00000).*((STATES(:,1) - STATES(:,2))./CONSTANTS(:,3)); ALGEBRAIC(:,27) = 156.500./(5.00000+exp(( - CONSTANTS(:,7).*ALGEBRAIC(:,14))./( CONSTANTS(:,36).*CONSTANTS(:,37)))); ALGEBRAIC(:,28) = 156.500 - 5.00000.*ALGEBRAIC(:,27); ALGEBRAIC(:,35) = STATES(:,1).*((ALGEBRAIC(:,27) - ALGEBRAIC(:,28).*exp(( CONSTANTS(:,7).*STATES(:,1))./( CONSTANTS(:,36).*CONSTANTS(:,37))))./(1.00000 - exp(( CONSTANTS(:,7).*STATES(:,1))./( CONSTANTS(:,36).*CONSTANTS(:,37))))); ALGEBRAIC(:,34) = 1.00000./(1.00000+exp((STATES(:,1) - CONSTANTS(:,24))./CONSTANTS(:,27))); ALGEBRAIC(:,36) = CONSTANTS(:,38).*power(ALGEBRAIC(:,34), 4.00000); ALGEBRAIC(:,37) = ALGEBRAIC(:,36).*(ALGEBRAIC(:,35)./45.0000); ALGEBRAIC(:,33) = piecewise({VOI>=0.00000&VOI<0.500000, 150.000 , VOI>=50.0000&VOI<50.5000, 150.000 , VOI>=100.000&VOI<100.500, 150.000 , VOI>=150.000&VOI<150.500, 150.000 , VOI>=200.000&VOI<200.500, 150.000 , VOI>=250.000&VOI<250.500, 150.000 , VOI>=300.000&VOI<300.500, 150.000 , VOI>=350.000&VOI<350.500, 150.000 , VOI>=400.000&VOI<400.500, 150.000 }, 0.00000); ALGEBRAIC(:,52) = ALGEBRAIC(:,37)+ALGEBRAIC(:,42)+ALGEBRAIC(:,44)+ALGEBRAIC(:,47)+ALGEBRAIC(:,51)+ - ALGEBRAIC(:,33); ALGEBRAIC(:,32) = STATES(:,2).*((STATES(:,4) - STATES(:,3).*exp(( -1.00000.*CONSTANTS(:,7).*STATES(:,2))./( CONSTANTS(:,36).*CONSTANTS(:,37))))./(1.00000 - exp(( -1.00000.*CONSTANTS(:,7).*STATES(:,2))./( CONSTANTS(:,36).*CONSTANTS(:,37))))); ALGEBRAIC(:,26) = (( CONSTANTS(:,36).*CONSTANTS(:,37))./CONSTANTS(:,7)).*log(STATES(:,3)./STATES(:,4)); ALGEBRAIC(:,57) = STATES(:,3).*exp( ( - CONSTANTS(:,42).*ALGEBRAIC(:,26)).*(CONSTANTS(:,7)./( CONSTANTS(:,36).*CONSTANTS(:,37)))); ALGEBRAIC(:,58) = CONSTANTS(:,41).*(power(ALGEBRAIC(:,57), 2.00000)./(CONSTANTS(:,43)+power(ALGEBRAIC(:,57), 2.00000))); ALGEBRAIC(:,59) = 1.00000 - power(1.00000+( CONSTANTS(:,44).*(1.00000+power(ALGEBRAIC(:,57), 2.00000)./CONSTANTS(:,43)))./( power(CONSTANTS(:,47), 2.00000).*exp(( 2.00000.*(1.00000 - CONSTANTS(:,42)).*STATES(:,2).*CONSTANTS(:,7))./( CONSTANTS(:,36).*CONSTANTS(:,37)))), -1.00000); ALGEBRAIC(:,60) = ALGEBRAIC(:,58).*ALGEBRAIC(:,59); ALGEBRAIC(:,61) = CONSTANTS(:,51).*ALGEBRAIC(:,60).*(ALGEBRAIC(:,32)./50.0000); ALGEBRAIC(:,62) = ( CONSTANTS(:,39).*power(STATES(:,14), 4.00000)).*STATES(:,15); ALGEBRAIC(:,63) = CONSTANTS(:,52).*ALGEBRAIC(:,62).*(ALGEBRAIC(:,32)./50.0000); ALGEBRAIC(:,67) = (1.00000./7.00000).*(exp(STATES(:,7)./67.3000) - 1.00000); ALGEBRAIC(:,68) = power(1.00000+ 0.120000.*exp( -0.100000.*STATES(:,2).*(CONSTANTS(:,7)./( CONSTANTS(:,36).*CONSTANTS(:,37))))+ 0.0400000.*ALGEBRAIC(:,67).*exp( - ( STATES(:,2).*(CONSTANTS(:,7)./( CONSTANTS(:,36).*CONSTANTS(:,37))))), -1.00000); ALGEBRAIC(:,69) = CONSTANTS(:,7).*(CONSTANTS(:,48)./( power(1.00000+CONSTANTS(:,45)./STATES(:,3), 2.00000).*power(1.00000+CONSTANTS(:,46)./STATES(:,6), 3.00000))); ALGEBRAIC(:,70) = CONSTANTS(:,54).*ALGEBRAIC(:,69).*ALGEBRAIC(:,68); ALGEBRAIC(:,65) = ( ( CONSTANTS(:,40).*power(STATES(:,16), 3.00000)).*STATES(:,17)).*STATES(:,18); ALGEBRAIC(:,64) = STATES(:,2).*((STATES(:,6) - STATES(:,7).*exp(( -1.00000.*CONSTANTS(:,7).*STATES(:,2))./( CONSTANTS(:,36).*CONSTANTS(:,37))))./(1.00000 - exp(( -1.00000.*CONSTANTS(:,7).*STATES(:,2))./( CONSTANTS(:,36).*CONSTANTS(:,37))))); ALGEBRAIC(:,66) = CONSTANTS(:,53).*ALGEBRAIC(:,65).*(ALGEBRAIC(:,64)./75.0000); ALGEBRAIC(:,29) = 156.500./(5.00000+exp(( - CONSTANTS(:,7).*ALGEBRAIC(:,26))./( CONSTANTS(:,36).*CONSTANTS(:,37)))); ALGEBRAIC(:,30) = 156.500 - 5.00000.*ALGEBRAIC(:,29); ALGEBRAIC(:,54) = STATES(:,2).*((ALGEBRAIC(:,29) - ALGEBRAIC(:,30).*exp(( CONSTANTS(:,7).*STATES(:,2))./( CONSTANTS(:,36).*CONSTANTS(:,37))))./(1.00000 - exp(( CONSTANTS(:,7).*STATES(:,2))./( CONSTANTS(:,36).*CONSTANTS(:,37))))); ALGEBRAIC(:,53) = 1.00000./(1.00000+exp((STATES(:,2) - CONSTANTS(:,24))./CONSTANTS(:,27))); ALGEBRAIC(:,55) = CONSTANTS(:,38).*power(ALGEBRAIC(:,53), 4.00000); ALGEBRAIC(:,56) = CONSTANTS(:,50).*ALGEBRAIC(:,55).*(ALGEBRAIC(:,54)./45.0000); ALGEBRAIC(:,71) = ALGEBRAIC(:,56)+ALGEBRAIC(:,61)+ALGEBRAIC(:,63)+ALGEBRAIC(:,66)+ALGEBRAIC(:,70); end % Compute result of a piecewise function function x = piecewise(cases, default) set = [0]; for i = 1:2:length(cases) if (length(cases{i+1}) == 1) x(cases{i} & ~set,:) = cases{i+1}; else x(cases{i} & ~set,:) = cases{i+1}(cases{i} & ~set); end set = set | cases{i}; if(set), break, end end if (length(default) == 1) x(~set,:) = default; else x(~set,:) = default(~set); end end % Pad out or shorten strings to a set length function strout = strpad(strin) req_length = 160; insize = size(strin,2); if insize > req_length strout = strin(1:req_length); else strout = [strin, blanks(req_length - insize)]; end end