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 =106; end % There are a total of 22 entries in each of the rate and state variable arrays. % There are a total of 93 entries in the constant variable array. % function [VOI, STATES, ALGEBRAIC, CONSTANTS] = solveModel() % Create ALGEBRAIC of correct size global algebraicVariableCount; algebraicVariableCount = getAlgebraicVariableCount(); % Initialise constants and state variables [INIT_STATES, CONSTANTS] = initConsts; % Set timespan to solve over tspan = [0, 10]; % Set numerical accuracy options for ODE solver options = odeset('RelTol', 1e-06, 'AbsTol', 1e-06, 'MaxStep', 1); % Solve model with ODE solver [VOI, STATES] = ode15s(@(VOI, STATES)computeRates(VOI, STATES, CONSTANTS), tspan, INIT_STATES, options); % Compute algebraic variables [RATES, ALGEBRAIC] = computeRates(VOI, STATES, CONSTANTS); ALGEBRAIC = computeAlgebraic(ALGEBRAIC, CONSTANTS, STATES, VOI); % Plot state variables against variable of integration [LEGEND_STATES, LEGEND_ALGEBRAIC, LEGEND_VOI, LEGEND_CONSTANTS] = createLegends(); figure(); plot(VOI, STATES); xlabel(LEGEND_VOI); l = legend(LEGEND_STATES); set(l,'Interpreter','none'); end function [LEGEND_STATES, LEGEND_ALGEBRAIC, LEGEND_VOI, LEGEND_CONSTANTS] = createLegends() LEGEND_STATES = ''; LEGEND_ALGEBRAIC = ''; LEGEND_VOI = ''; LEGEND_CONSTANTS = ''; LEGEND_VOI = strpad('time in component environment (ms)'); LEGEND_STATES(:,1) = strpad('V in component membrane (mV)'); LEGEND_CONSTANTS(:,1) = strpad('R in component membrane (mJ_per_mole_K)'); LEGEND_CONSTANTS(:,2) = strpad('T in component membrane (kelvin)'); LEGEND_CONSTANTS(:,3) = strpad('F in component membrane (C_per_mole)'); LEGEND_CONSTANTS(:,4) = strpad('Cm in component membrane (uF)'); LEGEND_ALGEBRAIC(:,1) = strpad('I_Stim in component membrane (uA)'); LEGEND_CONSTANTS(:,5) = strpad('stim_period in component membrane (ms)'); LEGEND_CONSTANTS(:,6) = strpad('stim_duration in component membrane (ms)'); LEGEND_CONSTANTS(:,7) = strpad('stim_amplitude in component membrane (uA)'); LEGEND_ALGEBRAIC(:,26) = strpad('i_Na in component sodium_current (nanoA)'); LEGEND_ALGEBRAIC(:,28) = strpad('i_t in component Ca_independent_transient_outward_K_current (nanoA)'); LEGEND_ALGEBRAIC(:,29) = strpad('i_ss in component steady_state_outward_K_current (nanoA)'); LEGEND_ALGEBRAIC(:,33) = strpad('i_f in component hyperpolarisation_activated_current (nanoA)'); LEGEND_ALGEBRAIC(:,30) = strpad('i_K1 in component inward_rectifier (nanoA)'); LEGEND_ALGEBRAIC(:,34) = strpad('i_B_Na in component background_currents (nanoA)'); LEGEND_ALGEBRAIC(:,36) = strpad('i_B_K in component background_currents (nanoA)'); LEGEND_ALGEBRAIC(:,22) = strpad('i_NaK in component sodium_potassium_pump (uA)'); LEGEND_ALGEBRAIC(:,106) = strpad('I_LCC in component convert_hinch (uA)'); LEGEND_ALGEBRAIC(:,39) = strpad('I_NaCa in component convert_hinch (uA)'); LEGEND_ALGEBRAIC(:,42) = strpad('I_pCa in component convert_hinch (uA)'); LEGEND_ALGEBRAIC(:,45) = strpad('I_CaB in component convert_hinch (uA)'); LEGEND_ALGEBRAIC(:,12) = strpad('FVRT in component membrane (dimensionless)'); LEGEND_ALGEBRAIC(:,21) = strpad('FVRT_Ca in component membrane (dimensionless)'); LEGEND_CONSTANTS(:,8) = strpad('V_myo in component cell_geometry (um3)'); LEGEND_CONSTANTS(:,9) = strpad('V_SR in component cell_geometry (um3)'); LEGEND_CONSTANTS(:,10) = strpad('V_myo_uL in component cell_geometry (uL)'); LEGEND_CONSTANTS(:,11) = strpad('V_SR_uL in component cell_geometry (uL)'); LEGEND_ALGEBRAIC(:,105) = strpad('I_LCC in component LCC_current (mM_per_ms)'); LEGEND_ALGEBRAIC(:,38) = strpad('I_NaCa in component Na_Ca_Exchanger (mM_per_ms)'); LEGEND_ALGEBRAIC(:,41) = strpad('I_pCa in component Sarcolemmal_Ca_pump (mM_per_ms)'); LEGEND_ALGEBRAIC(:,44) = strpad('I_CaB in component Background_Ca_current (mM_per_ms)'); LEGEND_ALGEBRAIC(:,101) = strpad('I_RyR in component RyR_current (mM_per_ms)'); LEGEND_ALGEBRAIC(:,102) = strpad('I_RyR in component convert_hinch (mM_per_ms)'); LEGEND_CONSTANTS(:,12) = strpad('i_NaK_max in component sodium_potassium_pump (uA)'); LEGEND_CONSTANTS(:,13) = strpad('K_m_K in component sodium_potassium_pump (mM)'); LEGEND_CONSTANTS(:,14) = strpad('K_m_Na in component sodium_potassium_pump (mM)'); LEGEND_CONSTANTS(:,83) = strpad('sigma in component sodium_potassium_pump (dimensionless)'); LEGEND_CONSTANTS(:,15) = strpad('K_o in component standard_ionic_concentrations (millimolar)'); LEGEND_CONSTANTS(:,16) = strpad('Na_o in component standard_ionic_concentrations (millimolar)'); LEGEND_STATES(:,2) = strpad('Na_i in component intracellular_ion_concentrations (mM)'); LEGEND_STATES(:,3) = strpad('Ca_i in component intracellular_ion_concentrations (mM)'); LEGEND_STATES(:,4) = strpad('Ca_SR in component intracellular_ion_concentrations (mM)'); LEGEND_STATES(:,5) = strpad('K_i in component intracellular_ion_concentrations (mM)'); LEGEND_STATES(:,6) = strpad('TRPN in component intracellular_ion_concentrations (mM)'); LEGEND_ALGEBRAIC(:,31) = strpad('i_f_Na in component hyperpolarisation_activated_current (nanoA)'); LEGEND_ALGEBRAIC(:,32) = strpad('i_f_K in component hyperpolarisation_activated_current (nanoA)'); LEGEND_ALGEBRAIC(:,40) = strpad('I_SERCA in component SERCA (mM_per_ms)'); LEGEND_ALGEBRAIC(:,46) = strpad('I_SR in component SR_Ca_leak_current (mM_per_ms)'); LEGEND_ALGEBRAIC(:,24) = strpad('Ca_b in component intracellular_ion_concentrations (mM)'); LEGEND_CONSTANTS(:,17) = strpad('Ca_TRPN_Max in component troponin (mM)'); LEGEND_ALGEBRAIC(:,62) = strpad('J_TRPN in component troponin (mM_per_ms)'); LEGEND_ALGEBRAIC(:,47) = strpad('beta_CMDN in component calmodulin_Ca_buffer (dimensionless)'); LEGEND_ALGEBRAIC(:,25) = strpad('E_Na in component sodium_current (millivolt)'); LEGEND_CONSTANTS(:,18) = strpad('g_Na in component sodium_current (microS)'); LEGEND_CONSTANTS(:,84) = strpad('g_Na_endo in component sodium_current (microS)'); LEGEND_STATES(:,7) = strpad('m in component sodium_current_m_gate (dimensionless)'); LEGEND_STATES(:,8) = strpad('h in component sodium_current_h_gate (dimensionless)'); LEGEND_STATES(:,9) = strpad('j in component sodium_current_j_gate (dimensionless)'); LEGEND_ALGEBRAIC(:,27) = strpad('E_K in component Ca_independent_transient_outward_K_current (millivolt)'); LEGEND_CONSTANTS(:,19) = strpad('g_t in component Ca_independent_transient_outward_K_current (microS)'); LEGEND_CONSTANTS(:,85) = strpad('g_t_endo in component Ca_independent_transient_outward_K_current (microS)'); LEGEND_CONSTANTS(:,20) = strpad('a_endo in component Ca_independent_transient_outward_K_current (dimensionless)'); LEGEND_CONSTANTS(:,21) = strpad('b_endo in component Ca_independent_transient_outward_K_current (dimensionless)'); LEGEND_STATES(:,10) = strpad('r in component Ca_independent_transient_outward_K_current_r_gate (dimensionless)'); LEGEND_STATES(:,11) = strpad('s in component Ca_independent_transient_outward_K_current_s_gate (dimensionless)'); LEGEND_STATES(:,12) = strpad('s_slow in component Ca_independent_transient_outward_K_current_s_slow_gate (dimensionless)'); LEGEND_CONSTANTS(:,22) = strpad('g_ss in component steady_state_outward_K_current (microS)'); LEGEND_STATES(:,13) = strpad('r_ss in component steady_state_outward_K_current_r_ss_gate (dimensionless)'); LEGEND_STATES(:,14) = strpad('s_ss in component steady_state_outward_K_current_s_ss_gate (dimensionless)'); LEGEND_CONSTANTS(:,23) = strpad('g_K1 in component inward_rectifier (microS)'); LEGEND_CONSTANTS(:,24) = strpad('g_f in component hyperpolarisation_activated_current (microS)'); LEGEND_CONSTANTS(:,25) = strpad('f_Na in component hyperpolarisation_activated_current (dimensionless)'); LEGEND_CONSTANTS(:,86) = strpad('f_K in component hyperpolarisation_activated_current (dimensionless)'); LEGEND_STATES(:,15) = strpad('y in component hyperpolarisation_activated_current_y_gate (dimensionless)'); LEGEND_ALGEBRAIC(:,37) = strpad('i_B in component background_currents (nanoA)'); LEGEND_ALGEBRAIC(:,35) = strpad('i_B_Ca in component background_currents (nanoA)'); LEGEND_CONSTANTS(:,26) = strpad('g_B_Na in component background_currents (microS)'); LEGEND_CONSTANTS(:,27) = strpad('g_B_Ca in component background_currents (microS)'); LEGEND_CONSTANTS(:,28) = strpad('g_B_K in component background_currents (microS)'); LEGEND_CONSTANTS(:,29) = strpad('E_Ca in component background_currents (millivolt)'); LEGEND_CONSTANTS(:,30) = strpad('Ca_o in component standard_ionic_concentrations (millimolar)'); LEGEND_CONSTANTS(:,31) = strpad('g_D in component CaRU (um3_per_ms)'); LEGEND_CONSTANTS(:,32) = strpad('J_R in component CaRU (um3_per_ms)'); LEGEND_CONSTANTS(:,33) = strpad('J_L in component CaRU (um3_per_ms)'); LEGEND_CONSTANTS(:,34) = strpad('N in component CaRU (dimensionless)'); LEGEND_CONSTANTS(:,35) = strpad('K_mNa in component Na_Ca_Exchanger (mM)'); LEGEND_CONSTANTS(:,36) = strpad('K_mCa in component Na_Ca_Exchanger (mM)'); LEGEND_CONSTANTS(:,37) = strpad('eta in component Na_Ca_Exchanger (dimensionless)'); LEGEND_CONSTANTS(:,38) = strpad('k_sat in component Na_Ca_Exchanger (dimensionless)'); LEGEND_CONSTANTS(:,39) = strpad('g_NCX in component Na_Ca_Exchanger (mM_per_ms)'); LEGEND_CONSTANTS(:,40) = strpad('g_SERCA in component SERCA (mM_per_ms)'); LEGEND_CONSTANTS(:,41) = strpad('K_SERCA in component SERCA (mM)'); LEGEND_CONSTANTS(:,42) = strpad('g_pCa in component Sarcolemmal_Ca_pump (mM_per_ms)'); LEGEND_CONSTANTS(:,43) = strpad('K_mpCa in component Sarcolemmal_Ca_pump (mM)'); LEGEND_ALGEBRAIC(:,43) = strpad('E_Ca in component Background_Ca_current (mV)'); LEGEND_CONSTANTS(:,44) = strpad('g_CaB in component Background_Ca_current (mM_per_mV_ms)'); LEGEND_CONSTANTS(:,45) = strpad('g_SRl in component SR_Ca_leak_current (per_ms)'); LEGEND_CONSTANTS(:,46) = strpad('k_CMDN in component calmodulin_Ca_buffer (mM)'); LEGEND_CONSTANTS(:,47) = strpad('B_CMDN in component calmodulin_Ca_buffer (mM)'); LEGEND_STATES(:,16) = strpad('z in component tropomyosin (dimensionless)'); LEGEND_ALGEBRAIC(:,55) = strpad('z_max in component tropomyosin (dimensionless)'); LEGEND_CONSTANTS(:,48) = strpad('k_on in component troponin (per_mM_per_ms)'); LEGEND_CONSTANTS(:,49) = strpad('k_Ref_off in component troponin (per_ms)'); LEGEND_CONSTANTS(:,50) = strpad('gamma_trpn in component troponin (dimensionless)'); LEGEND_CONSTANTS(:,51) = strpad('alpha_0 in component tropomyosin (per_ms)'); LEGEND_CONSTANTS(:,52) = strpad('alpha_r1 in component tropomyosin (per_ms)'); LEGEND_CONSTANTS(:,53) = strpad('alpha_r2 in component tropomyosin (per_ms)'); LEGEND_CONSTANTS(:,54) = strpad('n_Rel in component tropomyosin (dimensionless)'); LEGEND_CONSTANTS(:,55) = strpad('K_z in component tropomyosin (dimensionless)'); LEGEND_CONSTANTS(:,56) = strpad('n_Hill in component tropomyosin (dimensionless)'); LEGEND_CONSTANTS(:,57) = strpad('Ca_50ref in component tropomyosin (mM)'); LEGEND_CONSTANTS(:,58) = strpad('z_p in component tropomyosin (dimensionless)'); LEGEND_CONSTANTS(:,59) = strpad('beta_1 in component tropomyosin (dimensionless)'); LEGEND_ALGEBRAIC(:,52) = strpad('Ca_50 in component tropomyosin (mM)'); LEGEND_ALGEBRAIC(:,53) = strpad('Ca_TRPN_50 in component tropomyosin (mM)'); LEGEND_CONSTANTS(:,87) = strpad('K_2 in component tropomyosin (per_ms)'); LEGEND_CONSTANTS(:,91) = strpad('K_1 in component tropomyosin (per_ms)'); LEGEND_ALGEBRAIC(:,54) = strpad('alpha_Tm in component tropomyosin (per_ms)'); LEGEND_ALGEBRAIC(:,48) = strpad('beta_Tm in component tropomyosin (per_ms)'); LEGEND_CONSTANTS(:,60) = strpad('beta_0 in component filament_overlap (dimensionless)'); LEGEND_ALGEBRAIC(:,50) = strpad('lambda in component Myofilaments (dimensionless)'); LEGEND_ALGEBRAIC(:,61) = strpad('k_off in component troponin (per_ms)'); LEGEND_ALGEBRAIC(:,60) = strpad('Tension in component Cross_Bridges (N_per_mm2)'); LEGEND_CONSTANTS(:,61) = strpad('T_ref in component length_independent_tension (N_per_mm2)'); LEGEND_ALGEBRAIC(:,49) = strpad('ExtensionRatio in component Myofilaments (dimensionless)'); LEGEND_CONSTANTS(:,88) = strpad('dExtensionRatiodt in component Myofilaments (per_ms)'); LEGEND_ALGEBRAIC(:,51) = strpad('lambda_prev in component Myofilaments (dimensionless)'); LEGEND_ALGEBRAIC(:,56) = strpad('overlap in component filament_overlap (dimensionless)'); LEGEND_ALGEBRAIC(:,57) = strpad('T_Base in component length_independent_tension (N_per_mm2)'); LEGEND_ALGEBRAIC(:,58) = strpad('T_0 in component isometric_tension (N_per_mm2)'); LEGEND_ALGEBRAIC(:,59) = strpad('Q in component Cross_Bridges (dimensionless)'); LEGEND_CONSTANTS(:,62) = strpad('a in component Cross_Bridges (dimensionless)'); LEGEND_STATES(:,17) = strpad('Q_1 in component Cross_Bridges (dimensionless)'); LEGEND_STATES(:,18) = strpad('Q_2 in component Cross_Bridges (dimensionless)'); LEGEND_STATES(:,19) = strpad('Q_3 in component Cross_Bridges (dimensionless)'); LEGEND_CONSTANTS(:,63) = strpad('A_1 in component Cross_Bridges (dimensionless)'); LEGEND_CONSTANTS(:,64) = strpad('A_2 in component Cross_Bridges (dimensionless)'); LEGEND_CONSTANTS(:,65) = strpad('A_3 in component Cross_Bridges (dimensionless)'); LEGEND_CONSTANTS(:,66) = strpad('alpha_1 in component Cross_Bridges (per_ms)'); LEGEND_CONSTANTS(:,67) = strpad('alpha_2 in component Cross_Bridges (per_ms)'); LEGEND_CONSTANTS(:,68) = strpad('alpha_3 in component Cross_Bridges (per_ms)'); LEGEND_ALGEBRAIC(:,2) = strpad('m_infinity in component sodium_current_m_gate (dimensionless)'); LEGEND_ALGEBRAIC(:,13) = strpad('tau_m in component sodium_current_m_gate (second)'); LEGEND_ALGEBRAIC(:,3) = strpad('h_infinity in component sodium_current_h_gate (dimensionless)'); LEGEND_ALGEBRAIC(:,14) = strpad('tau_h in component sodium_current_h_gate (second)'); LEGEND_ALGEBRAIC(:,4) = strpad('j_infinity in component sodium_current_j_gate (dimensionless)'); LEGEND_ALGEBRAIC(:,15) = strpad('tau_j in component sodium_current_j_gate (second)'); LEGEND_ALGEBRAIC(:,16) = strpad('tau_r in component Ca_independent_transient_outward_K_current_r_gate (second)'); LEGEND_ALGEBRAIC(:,5) = strpad('r_infinity in component Ca_independent_transient_outward_K_current_r_gate (dimensionless)'); LEGEND_ALGEBRAIC(:,17) = strpad('tau_s_endo in component Ca_independent_transient_outward_K_current_s_gate (second)'); LEGEND_ALGEBRAIC(:,6) = strpad('s_infinity in component Ca_independent_transient_outward_K_current_s_gate (dimensionless)'); LEGEND_ALGEBRAIC(:,18) = strpad('tau_s_slow_endo in component Ca_independent_transient_outward_K_current_s_slow_gate (second)'); LEGEND_ALGEBRAIC(:,7) = strpad('s_slow_infinity in component Ca_independent_transient_outward_K_current_s_slow_gate (dimensionless)'); LEGEND_ALGEBRAIC(:,19) = strpad('tau_r_ss in component steady_state_outward_K_current_r_ss_gate (second)'); LEGEND_ALGEBRAIC(:,8) = strpad('r_ss_infinity in component steady_state_outward_K_current_r_ss_gate (dimensionless)'); LEGEND_CONSTANTS(:,89) = strpad('tau_s_ss in component steady_state_outward_K_current_s_ss_gate (second)'); LEGEND_ALGEBRAIC(:,9) = strpad('s_ss_infinity in component steady_state_outward_K_current_s_ss_gate (dimensionless)'); LEGEND_ALGEBRAIC(:,20) = strpad('tau_y in component hyperpolarisation_activated_current_y_gate (second)'); LEGEND_ALGEBRAIC(:,10) = strpad('y_infinity in component hyperpolarisation_activated_current_y_gate (dimensionless)'); LEGEND_ALGEBRAIC(:,82) = strpad('C_oc in component DS_Calcium_Concentrations (mM)'); LEGEND_ALGEBRAIC(:,80) = strpad('C_co in component DS_Calcium_Concentrations (mM)'); LEGEND_CONSTANTS(:,69) = strpad('V_L in component CaRU_Transitions (mV)'); LEGEND_CONSTANTS(:,70) = strpad('del_VL in component CaRU_Transitions (mV)'); LEGEND_CONSTANTS(:,71) = strpad('phi_L in component CaRU_Transitions (dimensionless)'); LEGEND_CONSTANTS(:,72) = strpad('t_L in component CaRU_Transitions (ms)'); LEGEND_CONSTANTS(:,73) = strpad('tau_L in component CaRU_Transitions (ms)'); LEGEND_CONSTANTS(:,90) = strpad('t_R in component CaRU_Transitions (ms)'); LEGEND_CONSTANTS(:,74) = strpad('tau_R in component CaRU_Transitions (ms)'); LEGEND_CONSTANTS(:,75) = strpad('phi_R in component CaRU_Transitions (dimensionless)'); LEGEND_CONSTANTS(:,76) = strpad('theta_R in component CaRU_Transitions (dimensionless)'); LEGEND_CONSTANTS(:,77) = strpad('K_RyR in component CaRU_Transitions (mM)'); LEGEND_CONSTANTS(:,78) = strpad('K_L in component CaRU_Transitions (mM)'); LEGEND_CONSTANTS(:,79) = strpad('a in component CaRU_Transitions (dimensionless)'); LEGEND_CONSTANTS(:,80) = strpad('b in component CaRU_Transitions (dimensionless)'); LEGEND_CONSTANTS(:,81) = strpad('c in component CaRU_Transitions (dimensionless)'); LEGEND_CONSTANTS(:,82) = strpad('d in component CaRU_Transitions (dimensionless)'); LEGEND_ALGEBRAIC(:,63) = strpad('expVL in component CaRU_Transitions (dimensionless)'); LEGEND_ALGEBRAIC(:,64) = strpad('alpha_p in component CaRU_Transitions (per_ms)'); LEGEND_CONSTANTS(:,92) = strpad('alpha_m in component CaRU_Transitions (per_ms)'); LEGEND_ALGEBRAIC(:,83) = strpad('beta_poc in component CaRU_Transitions (per_ms)'); LEGEND_ALGEBRAIC(:,65) = strpad('beta_pcc in component CaRU_Transitions (per_ms)'); LEGEND_CONSTANTS(:,93) = strpad('beta_m in component CaRU_Transitions (per_ms)'); LEGEND_ALGEBRAIC(:,81) = strpad('epsilon_pco in component CaRU_Transitions (per_ms)'); LEGEND_ALGEBRAIC(:,66) = strpad('epsilon_pcc in component CaRU_Transitions (per_ms)'); LEGEND_ALGEBRAIC(:,67) = strpad('epsilon_m in component CaRU_Transitions (per_ms)'); LEGEND_ALGEBRAIC(:,84) = strpad('mu_poc in component CaRU_Transitions (per_ms)'); LEGEND_ALGEBRAIC(:,68) = strpad('mu_pcc in component CaRU_Transitions (per_ms)'); LEGEND_ALGEBRAIC(:,85) = strpad('mu_moc in component CaRU_Transitions (per_ms)'); LEGEND_ALGEBRAIC(:,69) = strpad('mu_mcc in component CaRU_Transitions (per_ms)'); LEGEND_ALGEBRAIC(:,86) = strpad('denom in component CaRU_states (per_ms3)'); LEGEND_ALGEBRAIC(:,87) = strpad('y_oc in component CaRU_states (dimensionless)'); LEGEND_ALGEBRAIC(:,88) = strpad('y_co in component CaRU_states (dimensionless)'); LEGEND_ALGEBRAIC(:,89) = strpad('y_oo in component CaRU_states (dimensionless)'); LEGEND_ALGEBRAIC(:,91) = strpad('y_cc in component CaRU_states (dimensionless)'); LEGEND_ALGEBRAIC(:,70) = strpad('y_ci in component CaRU_states (dimensionless)'); LEGEND_ALGEBRAIC(:,71) = strpad('y_oi in component CaRU_states (dimensionless)'); LEGEND_ALGEBRAIC(:,72) = strpad('y_ic in component CaRU_states (dimensionless)'); LEGEND_ALGEBRAIC(:,73) = strpad('y_io in component CaRU_states (dimensionless)'); LEGEND_ALGEBRAIC(:,93) = strpad('y_ii in component CaRU_states (dimensionless)'); LEGEND_ALGEBRAIC(:,94) = strpad('r_1 in component CaRU_reduced_states (per_ms)'); LEGEND_ALGEBRAIC(:,96) = strpad('r_2 in component CaRU_reduced_states (per_ms)'); LEGEND_ALGEBRAIC(:,74) = strpad('r_3 in component CaRU_reduced_states (per_ms)'); LEGEND_ALGEBRAIC(:,75) = strpad('r_4 in component CaRU_reduced_states (per_ms)'); LEGEND_ALGEBRAIC(:,98) = strpad('r_5 in component CaRU_reduced_states (per_ms)'); LEGEND_ALGEBRAIC(:,76) = strpad('r_6 in component CaRU_reduced_states (per_ms)'); LEGEND_ALGEBRAIC(:,77) = strpad('r_7 in component CaRU_reduced_states (per_ms)'); LEGEND_ALGEBRAIC(:,78) = strpad('r_8 in component CaRU_reduced_states (per_ms)'); LEGEND_STATES(:,20) = strpad('z_1 in component CaRU_reduced_states (dimensionless)'); LEGEND_STATES(:,21) = strpad('z_2 in component CaRU_reduced_states (dimensionless)'); LEGEND_STATES(:,22) = strpad('z_3 in component CaRU_reduced_states (dimensionless)'); LEGEND_ALGEBRAIC(:,79) = strpad('z_4 in component CaRU_reduced_states (dimensionless)'); LEGEND_ALGEBRAIC(:,11) = strpad('C_cc in component DS_Calcium_Concentrations (mM)'); LEGEND_ALGEBRAIC(:,23) = strpad('C_oo in component DS_Calcium_Concentrations (mM)'); LEGEND_ALGEBRAIC(:,97) = strpad('J_Loo in component LCC_and_RyR_fluxes (um3_mM_per_ms)'); LEGEND_ALGEBRAIC(:,95) = strpad('J_Loc in component LCC_and_RyR_fluxes (um3_mM_per_ms)'); LEGEND_ALGEBRAIC(:,90) = strpad('J_Rco in component LCC_and_RyR_fluxes (um3_mM_per_ms)'); LEGEND_ALGEBRAIC(:,92) = strpad('J_Roo in component LCC_and_RyR_fluxes (um3_mM_per_ms)'); LEGEND_ALGEBRAIC(:,99) = strpad('J_R1 in component RyR_current (um3_mM_per_ms)'); LEGEND_ALGEBRAIC(:,100) = strpad('J_R3 in component RyR_current (um3_mM_per_ms)'); LEGEND_ALGEBRAIC(:,103) = strpad('J_L1 in component LCC_current (um3_mM_per_ms)'); LEGEND_ALGEBRAIC(:,104) = strpad('J_L2 in component LCC_current (um3_mM_per_ms)'); LEGEND_RATES(:,1) = strpad('d/dt V in component membrane (mV)'); LEGEND_RATES(:,2) = strpad('d/dt Na_i in component intracellular_ion_concentrations (mM)'); LEGEND_RATES(:,5) = strpad('d/dt K_i in component intracellular_ion_concentrations (mM)'); LEGEND_RATES(:,6) = strpad('d/dt TRPN in component intracellular_ion_concentrations (mM)'); LEGEND_RATES(:,3) = strpad('d/dt Ca_i in component intracellular_ion_concentrations (mM)'); LEGEND_RATES(:,4) = strpad('d/dt Ca_SR in component intracellular_ion_concentrations (mM)'); LEGEND_RATES(:,16) = strpad('d/dt z in component tropomyosin (dimensionless)'); LEGEND_RATES(:,17) = strpad('d/dt Q_1 in component Cross_Bridges (dimensionless)'); LEGEND_RATES(:,18) = strpad('d/dt Q_2 in component Cross_Bridges (dimensionless)'); LEGEND_RATES(:,19) = strpad('d/dt Q_3 in component Cross_Bridges (dimensionless)'); LEGEND_RATES(:,7) = strpad('d/dt m in component sodium_current_m_gate (dimensionless)'); LEGEND_RATES(:,8) = strpad('d/dt h in component sodium_current_h_gate (dimensionless)'); LEGEND_RATES(:,9) = strpad('d/dt j in component sodium_current_j_gate (dimensionless)'); LEGEND_RATES(:,10) = strpad('d/dt r in component Ca_independent_transient_outward_K_current_r_gate (dimensionless)'); LEGEND_RATES(:,11) = strpad('d/dt s in component Ca_independent_transient_outward_K_current_s_gate (dimensionless)'); LEGEND_RATES(:,12) = strpad('d/dt s_slow in component Ca_independent_transient_outward_K_current_s_slow_gate (dimensionless)'); LEGEND_RATES(:,13) = strpad('d/dt r_ss in component steady_state_outward_K_current_r_ss_gate (dimensionless)'); LEGEND_RATES(:,14) = strpad('d/dt s_ss in component steady_state_outward_K_current_s_ss_gate (dimensionless)'); LEGEND_RATES(:,15) = strpad('d/dt y in component hyperpolarisation_activated_current_y_gate (dimensionless)'); LEGEND_RATES(:,20) = strpad('d/dt z_1 in component CaRU_reduced_states (dimensionless)'); LEGEND_RATES(:,21) = strpad('d/dt z_2 in component CaRU_reduced_states (dimensionless)'); LEGEND_RATES(:,22) = strpad('d/dt z_3 in component CaRU_reduced_states (dimensionless)'); LEGEND_STATES = LEGEND_STATES'; LEGEND_ALGEBRAIC = LEGEND_ALGEBRAIC'; LEGEND_RATES = LEGEND_RATES'; LEGEND_CONSTANTS = LEGEND_CONSTANTS'; end function [STATES, CONSTANTS] = initConsts() VOI = 0; CONSTANTS = []; STATES = []; ALGEBRAIC = []; STATES(:,1) = -80.50146; CONSTANTS(:,1) = 8314.5; CONSTANTS(:,2) = 295; CONSTANTS(:,3) = 96487; CONSTANTS(:,4) = 0.0001; CONSTANTS(:,5) = 1e3; CONSTANTS(:,6) = 10; CONSTANTS(:,7) = -0.6e-3; CONSTANTS(:,8) = 25.85e3; CONSTANTS(:,9) = 2.098e3; CONSTANTS(:,10) = 25.85e-6; CONSTANTS(:,11) = 2.098e-6; CONSTANTS(:,12) = 0.95e-4; CONSTANTS(:,13) = 1.5; CONSTANTS(:,14) = 10; CONSTANTS(:,15) = 5.4; CONSTANTS(:,16) = 140; STATES(:,2) = 10.73519; STATES(:,3) = 0.00007901351; STATES(:,4) = 700.0e-3; STATES(:,5) = 139.2751; STATES(:,6) = 0.067593139865; CONSTANTS(:,17) = 70e-3; CONSTANTS(:,18) = 0.8; STATES(:,7) = 0.004164108; STATES(:,8) = 0.6735613; STATES(:,9) = 0.6729362; CONSTANTS(:,19) = 0.035; CONSTANTS(:,20) = 0.583; CONSTANTS(:,21) = 0.417; STATES(:,10) = 0.002191519; STATES(:,11) = 0.9842542; STATES(:,12) = 0.6421196; CONSTANTS(:,22) = 0.007; STATES(:,13) = 0.002907171; STATES(:,14) = 0.3142767; CONSTANTS(:,23) = 0.024; CONSTANTS(:,24) = 0.00145; CONSTANTS(:,25) = 0.2; STATES(:,15) = 0.003578708; CONSTANTS(:,26) = 0.00008015; CONSTANTS(:,27) = 0.0000324; CONSTANTS(:,28) = 0.000138; CONSTANTS(:,29) = 65; CONSTANTS(:,30) = 1.2; CONSTANTS(:,31) = 0.065; CONSTANTS(:,32) = 0.02; CONSTANTS(:,33) = 9.13e-4; CONSTANTS(:,34) = 50000; CONSTANTS(:,35) = 87.5; CONSTANTS(:,36) = 1.38; CONSTANTS(:,37) = 0.35; CONSTANTS(:,38) = 0.1; CONSTANTS(:,39) = 38.5e-3; CONSTANTS(:,40) = 0.45e-3; CONSTANTS(:,41) = 0.5e-3; CONSTANTS(:,42) = 0.0035e-3; CONSTANTS(:,43) = 0.5e-3; CONSTANTS(:,44) = 2.6875e-8; CONSTANTS(:,45) = 1.8951e-5; CONSTANTS(:,46) = 2.382e-3; CONSTANTS(:,47) = 50e-3; STATES(:,16) = 0.014417937837; CONSTANTS(:,48) = 100; CONSTANTS(:,49) = 0.2; CONSTANTS(:,50) = 2; CONSTANTS(:,51) = 8e-3; CONSTANTS(:,52) = 2e-3; CONSTANTS(:,53) = 1.75e-3; CONSTANTS(:,54) = 3; CONSTANTS(:,55) = 0.15; CONSTANTS(:,56) = 3; CONSTANTS(:,57) = 1.05e-3; CONSTANTS(:,58) = 0.85; CONSTANTS(:,59) = -4; CONSTANTS(:,60) = 4.9; CONSTANTS(:,61) = 56.2; CONSTANTS(:,62) = 0.35; STATES(:,17) = 0; STATES(:,18) = 0; STATES(:,19) = 0; CONSTANTS(:,63) = -29; CONSTANTS(:,64) = 138; CONSTANTS(:,65) = 129; CONSTANTS(:,66) = 0.03; CONSTANTS(:,67) = 0.13; CONSTANTS(:,68) = 0.625; CONSTANTS(:,69) = -2; CONSTANTS(:,70) = 7; CONSTANTS(:,71) = 2.35; CONSTANTS(:,72) = 1; CONSTANTS(:,73) = 650; CONSTANTS(:,74) = 2.43; CONSTANTS(:,75) = 0.05; CONSTANTS(:,76) = 0.012; CONSTANTS(:,77) = 41e-3; CONSTANTS(:,78) = 0.22e-3; CONSTANTS(:,79) = 0.0625; CONSTANTS(:,80) = 14; CONSTANTS(:,81) = 0.01; CONSTANTS(:,82) = 100; STATES(:,20) = 0.98859; STATES(:,21) = 0.0087302; STATES(:,22) = 0.0026566; CONSTANTS(:,83) = (exp(CONSTANTS(:,16)./67.3000) - 1.00000)./7.00000; CONSTANTS(:,84) = 1.33000.*CONSTANTS(:,18); CONSTANTS(:,85) = 0.464700.*CONSTANTS(:,19); CONSTANTS(:,86) = 1.00000 - CONSTANTS(:,25); CONSTANTS(:,87) = (( CONSTANTS(:,53).*power(CONSTANTS(:,58), CONSTANTS(:,54)))./(power(CONSTANTS(:,58), CONSTANTS(:,54))+power(CONSTANTS(:,55), CONSTANTS(:,54)))).*(1.00000 - ( CONSTANTS(:,54).*power(CONSTANTS(:,55), CONSTANTS(:,54)))./(power(CONSTANTS(:,58), CONSTANTS(:,54))+power(CONSTANTS(:,55), CONSTANTS(:,54)))); CONSTANTS(:,88) = 0.00000; CONSTANTS(:,89) = 2.10000; CONSTANTS(:,90) = 1.17000.*CONSTANTS(:,72); CONSTANTS(:,91) = ( CONSTANTS(:,53).*power(CONSTANTS(:,58), CONSTANTS(:,54) - 1.00000).*CONSTANTS(:,54).*power(CONSTANTS(:,55), CONSTANTS(:,54)))./power(power(CONSTANTS(:,58), CONSTANTS(:,54))+power(CONSTANTS(:,55), CONSTANTS(:,54)), 2.00000); CONSTANTS(:,92) = CONSTANTS(:,71)./CONSTANTS(:,72); CONSTANTS(:,93) = CONSTANTS(:,75)./CONSTANTS(:,90); 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(:,17) = CONSTANTS(:,63).*CONSTANTS(:,88) - CONSTANTS(:,66).*STATES(:,17); RATES(:,18) = CONSTANTS(:,64).*CONSTANTS(:,88) - CONSTANTS(:,67).*STATES(:,18); RATES(:,19) = CONSTANTS(:,65).*CONSTANTS(:,88) - CONSTANTS(:,68).*STATES(:,19); ALGEBRAIC(:,9) = 1.00000./(1.00000+exp((STATES(:,1)+87.5000)./10.3000)); RATES(:,14) = ((ALGEBRAIC(:,9) - STATES(:,14))./CONSTANTS(:,89)).*0.00100000; ALGEBRAIC(:,2) = 1.00000./(1.00000+exp((STATES(:,1)+45.0000)./ - 6.50000)); ALGEBRAIC(:,13) = 0.00136000./(( 0.320000.*(STATES(:,1)+47.1300))./(1.00000 - exp( - 0.100000.*(STATES(:,1)+47.1300)))+ 0.0800000.*exp( - STATES(:,1)./11.0000)); RATES(:,7) = ((ALGEBRAIC(:,2) - STATES(:,7))./ALGEBRAIC(:,13)).*0.00100000; ALGEBRAIC(:,3) = 1.00000./(1.00000+exp((STATES(:,1)+76.1000)./6.07000)); ALGEBRAIC(:,14) = piecewise({STATES(:,1)>= - 40.0000, 0.000453700.*(1.00000+exp( - (STATES(:,1)+10.6600)./11.1000)) }, 0.00349000./( 0.135000.*exp( - (STATES(:,1)+80.0000)./6.80000)+ 3.56000.*exp( 0.0790000.*STATES(:,1))+ 310000..*exp( 0.350000.*STATES(:,1)))); RATES(:,8) = ((ALGEBRAIC(:,3) - STATES(:,8))./ALGEBRAIC(:,14)).*0.00100000; ALGEBRAIC(:,4) = 1.00000./(1.00000+exp((STATES(:,1)+76.1000)./6.07000)); ALGEBRAIC(:,15) = piecewise({STATES(:,1)>= - 40.0000, ( 0.0116300.*(1.00000+exp( - 0.100000.*(STATES(:,1)+32.0000))))./exp( - 2.53500e-07.*STATES(:,1)) }, 0.00349000./( ((STATES(:,1)+37.7800)./(1.00000+exp( 0.311000.*(STATES(:,1)+79.2300)))).*( - 127140..*exp( 0.244400.*STATES(:,1)) - 3.47400e-05.*exp( - 0.0439100.*STATES(:,1)))+( 0.121200.*exp( - 0.0105200.*STATES(:,1)))./(1.00000+exp( - 0.137800.*(STATES(:,1)+40.1400))))); RATES(:,9) = ((ALGEBRAIC(:,4) - STATES(:,9))./ALGEBRAIC(:,15)).*0.00100000; ALGEBRAIC(:,16) = 1.00000./( 45.1600.*exp( 0.0357700.*(STATES(:,1)+50.0000))+ 98.9000.*exp( - 0.100000.*(STATES(:,1)+38.0000))); ALGEBRAIC(:,5) = 1.00000./(1.00000+exp((STATES(:,1)+10.6000)./ - 11.4200)); RATES(:,10) = ((ALGEBRAIC(:,5) - STATES(:,10))./ALGEBRAIC(:,16)).*0.00100000; ALGEBRAIC(:,17) = 0.550000.*exp( - power((STATES(:,1)+70.0000)./25.0000, 2.00000))+0.0490000; ALGEBRAIC(:,6) = 1.00000./(1.00000+exp((STATES(:,1)+45.3000)./6.88410)); RATES(:,11) = ((ALGEBRAIC(:,6) - STATES(:,11))./ALGEBRAIC(:,17)).*0.00100000; ALGEBRAIC(:,18) = 3.30000.*exp(( ( - (STATES(:,1)+70.0000)./30.0000).*(STATES(:,1)+70.0000))./30.0000)+0.0490000; ALGEBRAIC(:,7) = 1.00000./(1.00000+exp((STATES(:,1)+45.3000)./6.88410)); RATES(:,12) = ((ALGEBRAIC(:,7) - STATES(:,12))./ALGEBRAIC(:,18)).*0.00100000; ALGEBRAIC(:,19) = 10.0000./( 45.1600.*exp( 0.0357700.*(STATES(:,1)+50.0000))+ 98.9000.*exp( - 0.100000.*(STATES(:,1)+38.0000))); ALGEBRAIC(:,8) = 1.00000./(1.00000+exp((STATES(:,1)+11.5000)./ - 11.8200)); RATES(:,13) = ((ALGEBRAIC(:,8) - STATES(:,13))./ALGEBRAIC(:,19)).*0.00100000; ALGEBRAIC(:,20) = 1.00000./( 0.118850.*exp((STATES(:,1)+80.0000)./28.3700)+ 0.562300.*exp((STATES(:,1)+80.0000)./ - 14.1900)); ALGEBRAIC(:,10) = 1.00000./(1.00000+exp((STATES(:,1)+138.600)./10.4800)); RATES(:,15) = ((ALGEBRAIC(:,10) - STATES(:,15))./ALGEBRAIC(:,20)).*0.00100000; ALGEBRAIC(:,1) = piecewise({VOI - floor(VOI./CONSTANTS(:,5)).*CONSTANTS(:,5)>=0.00000&VOI - floor(VOI./CONSTANTS(:,5)).*CONSTANTS(:,5)<=CONSTANTS(:,6), CONSTANTS(:,7) }, 0.00000); ALGEBRAIC(:,27) = (( CONSTANTS(:,1).*CONSTANTS(:,2))./CONSTANTS(:,3)).*log(CONSTANTS(:,15)./STATES(:,5)); ALGEBRAIC(:,28) = CONSTANTS(:,85).*STATES(:,10).*( CONSTANTS(:,20).*STATES(:,11)+ CONSTANTS(:,21).*STATES(:,12)).*(STATES(:,1) - ALGEBRAIC(:,27)); ALGEBRAIC(:,29) = CONSTANTS(:,22).*STATES(:,13).*STATES(:,14).*(STATES(:,1) - ALGEBRAIC(:,27)); ALGEBRAIC(:,30) = ( (48.0000./(exp((STATES(:,1)+37.0000)./25.0000)+exp((STATES(:,1)+37.0000)./ - 25.0000))+10.0000).*0.00100000)./(1.00000+exp((STATES(:,1) - (ALGEBRAIC(:,27)+76.7700))./ - 17.0000))+( CONSTANTS(:,23).*(STATES(:,1) - (ALGEBRAIC(:,27)+1.73000)))./( (1.00000+exp(( 1.61300.*CONSTANTS(:,3).*(STATES(:,1) - (ALGEBRAIC(:,27)+1.73000)))./( CONSTANTS(:,1).*CONSTANTS(:,2)))).*(1.00000+exp((CONSTANTS(:,15) - 0.998800)./ - 0.124000))); ALGEBRAIC(:,36) = CONSTANTS(:,28).*(STATES(:,1) - ALGEBRAIC(:,27)); ALGEBRAIC(:,22) = ( (( (( CONSTANTS(:,12).*1.00000)./(1.00000+ 0.124500.*exp(( - 0.100000.*STATES(:,1).*CONSTANTS(:,3))./( CONSTANTS(:,1).*CONSTANTS(:,2)))+ 0.0365000.*CONSTANTS(:,83).*exp(( - STATES(:,1).*CONSTANTS(:,3))./( CONSTANTS(:,1).*CONSTANTS(:,2))))).*CONSTANTS(:,15))./(CONSTANTS(:,15)+CONSTANTS(:,13))).*1.00000)./(1.00000+power(CONSTANTS(:,14)./STATES(:,2), 4.00000)); ALGEBRAIC(:,32) = CONSTANTS(:,24).*STATES(:,15).*CONSTANTS(:,86).*(STATES(:,1) - ALGEBRAIC(:,27)); RATES(:,5) = ( - (ALGEBRAIC(:,1)+ALGEBRAIC(:,29).*0.00100000+ALGEBRAIC(:,36).*0.00100000+ALGEBRAIC(:,28).*0.00100000+ALGEBRAIC(:,30).*0.00100000+ALGEBRAIC(:,32).*0.00100000+ ALGEBRAIC(:,22).* - 2.00000).*1.00000)./( CONSTANTS(:,10).*CONSTANTS(:,3)); ALGEBRAIC(:,25) = (( CONSTANTS(:,1).*CONSTANTS(:,2))./CONSTANTS(:,3)).*log(CONSTANTS(:,16)./STATES(:,2)); ALGEBRAIC(:,26) = CONSTANTS(:,84).*power(STATES(:,7), 3.00000).*STATES(:,8).*STATES(:,9).*(STATES(:,1) - ALGEBRAIC(:,25)); ALGEBRAIC(:,34) = CONSTANTS(:,26).*(STATES(:,1) - ALGEBRAIC(:,25)); ALGEBRAIC(:,12) = ( CONSTANTS(:,3).*STATES(:,1))./( CONSTANTS(:,1).*CONSTANTS(:,2)); ALGEBRAIC(:,38) = ( CONSTANTS(:,39).*( exp( CONSTANTS(:,37).*ALGEBRAIC(:,12)).*power(STATES(:,2), 3.00000).*CONSTANTS(:,30) - exp( (CONSTANTS(:,37) - 1.00000).*ALGEBRAIC(:,12)).*power(CONSTANTS(:,16), 3.00000).*STATES(:,3)))./( (power(CONSTANTS(:,16), 3.00000)+power(CONSTANTS(:,35), 3.00000)).*(CONSTANTS(:,30)+CONSTANTS(:,36)).*(1.00000+ CONSTANTS(:,38).*exp( (CONSTANTS(:,37) - 1.00000).*ALGEBRAIC(:,12)))); ALGEBRAIC(:,39) = ALGEBRAIC(:,38).*CONSTANTS(:,10).*CONSTANTS(:,3); ALGEBRAIC(:,31) = CONSTANTS(:,24).*STATES(:,15).*CONSTANTS(:,25).*(STATES(:,1) - ALGEBRAIC(:,25)); RATES(:,2) = ( - (ALGEBRAIC(:,26).*0.00100000+ALGEBRAIC(:,34).*0.00100000+ ALGEBRAIC(:,39).*3.00000+ ALGEBRAIC(:,22).*3.00000+ALGEBRAIC(:,31).*0.00100000).*1.00000)./( CONSTANTS(:,10).*CONSTANTS(:,3)); ALGEBRAIC(:,24) = CONSTANTS(:,17) - STATES(:,6); ALGEBRAIC(:,49) = piecewise({VOI>300000., 1.00000 }, 1.00000); ALGEBRAIC(:,50) = piecewise({ALGEBRAIC(:,49)>0.800000&ALGEBRAIC(:,49)<=1.15000, ALGEBRAIC(:,49) , ALGEBRAIC(:,49)>1.15000, 1.15000 }, 0.800000); ALGEBRAIC(:,52) = CONSTANTS(:,57).*(1.00000+ CONSTANTS(:,59).*(ALGEBRAIC(:,50) - 1.00000)); ALGEBRAIC(:,53) = ( ALGEBRAIC(:,52).*CONSTANTS(:,17))./(ALGEBRAIC(:,52)+ (CONSTANTS(:,49)./CONSTANTS(:,48)).*(1.00000 - ( (1.00000+ CONSTANTS(:,60).*(ALGEBRAIC(:,50) - 1.00000)).*0.500000)./CONSTANTS(:,50))); ALGEBRAIC(:,54) = CONSTANTS(:,51).*power(ALGEBRAIC(:,24)./ALGEBRAIC(:,53), CONSTANTS(:,56)); ALGEBRAIC(:,48) = CONSTANTS(:,52)+( CONSTANTS(:,53).*power(STATES(:,16), CONSTANTS(:,54) - 1.00000))./(power(STATES(:,16), CONSTANTS(:,54))+power(CONSTANTS(:,55), CONSTANTS(:,54))); RATES(:,16) = ALGEBRAIC(:,54).*(1.00000 - STATES(:,16)) - ALGEBRAIC(:,48).*STATES(:,16); ALGEBRAIC(:,56) = 1.00000+ CONSTANTS(:,60).*(ALGEBRAIC(:,50) - 1.00000); ALGEBRAIC(:,55) = (CONSTANTS(:,51)./power(ALGEBRAIC(:,53)./CONSTANTS(:,17), CONSTANTS(:,56)) - CONSTANTS(:,87))./(CONSTANTS(:,52)+CONSTANTS(:,91)+CONSTANTS(:,51)./power(ALGEBRAIC(:,53)./CONSTANTS(:,17), CONSTANTS(:,56))); ALGEBRAIC(:,57) = ( CONSTANTS(:,61).*STATES(:,16))./ALGEBRAIC(:,55); ALGEBRAIC(:,58) = ALGEBRAIC(:,57).*ALGEBRAIC(:,56); ALGEBRAIC(:,59) = STATES(:,17)+STATES(:,18)+STATES(:,19); ALGEBRAIC(:,60) = piecewise({ALGEBRAIC(:,59)<0.00000, ( ALGEBRAIC(:,58).*( CONSTANTS(:,62).*ALGEBRAIC(:,59)+1.00000))./(1.00000 - ALGEBRAIC(:,59)) }, ( ALGEBRAIC(:,58).*(1.00000+ (CONSTANTS(:,62)+2.00000).*ALGEBRAIC(:,59)))./(1.00000+ALGEBRAIC(:,59))); ALGEBRAIC(:,61) = piecewise({1.00000 - ALGEBRAIC(:,60)./( CONSTANTS(:,50).*CONSTANTS(:,61))>0.100000, CONSTANTS(:,49).*(1.00000 - ALGEBRAIC(:,60)./( CONSTANTS(:,50).*CONSTANTS(:,61))) }, CONSTANTS(:,49).*0.100000); ALGEBRAIC(:,62) = (CONSTANTS(:,17) - STATES(:,6)).*ALGEBRAIC(:,61) - STATES(:,3).*STATES(:,6).*CONSTANTS(:,48); RATES(:,6) = ALGEBRAIC(:,62); ALGEBRAIC(:,21) = 2.00000.*ALGEBRAIC(:,12); ALGEBRAIC(:,82) = piecewise({abs(ALGEBRAIC(:,21))>1.00000e-09, (STATES(:,3)+( (CONSTANTS(:,33)./CONSTANTS(:,31)).*CONSTANTS(:,30).*ALGEBRAIC(:,21).*exp( - ALGEBRAIC(:,21)))./(1.00000 - exp( - ALGEBRAIC(:,21))))./(1.00000+( (CONSTANTS(:,33)./CONSTANTS(:,31)).*ALGEBRAIC(:,21))./(1.00000 - exp( - ALGEBRAIC(:,21)))) }, (STATES(:,3)+ (CONSTANTS(:,33)./CONSTANTS(:,31)).*CONSTANTS(:,30))./(1.00000+CONSTANTS(:,33)./CONSTANTS(:,31))); ALGEBRAIC(:,84) = (power(ALGEBRAIC(:,82), 2.00000)+ CONSTANTS(:,81).*power(CONSTANTS(:,77), 2.00000))./( CONSTANTS(:,74).*(power(ALGEBRAIC(:,82), 2.00000)+power(CONSTANTS(:,77), 2.00000))); ALGEBRAIC(:,68) = (power(STATES(:,3), 2.00000)+ CONSTANTS(:,81).*power(CONSTANTS(:,77), 2.00000))./( CONSTANTS(:,74).*(power(STATES(:,3), 2.00000)+power(CONSTANTS(:,77), 2.00000))); ALGEBRAIC(:,63) = exp((STATES(:,1) - CONSTANTS(:,69))./CONSTANTS(:,70)); ALGEBRAIC(:,64) = ALGEBRAIC(:,63)./( CONSTANTS(:,72).*(ALGEBRAIC(:,63)+1.00000)); ALGEBRAIC(:,65) = power(STATES(:,3), 2.00000)./( CONSTANTS(:,90).*(power(STATES(:,3), 2.00000)+power(CONSTANTS(:,77), 2.00000))); ALGEBRAIC(:,83) = power(ALGEBRAIC(:,82), 2.00000)./( CONSTANTS(:,90).*(power(ALGEBRAIC(:,82), 2.00000)+power(CONSTANTS(:,77), 2.00000))); ALGEBRAIC(:,86) = (ALGEBRAIC(:,64)+CONSTANTS(:,92)).*( (CONSTANTS(:,92)+CONSTANTS(:,93)+ALGEBRAIC(:,83)).*(CONSTANTS(:,93)+ALGEBRAIC(:,65))+ ALGEBRAIC(:,64).*(CONSTANTS(:,93)+ALGEBRAIC(:,83))); ALGEBRAIC(:,87) = ( ALGEBRAIC(:,64).*CONSTANTS(:,93).*(ALGEBRAIC(:,64)+CONSTANTS(:,92)+CONSTANTS(:,93)+ALGEBRAIC(:,65)))./ALGEBRAIC(:,86); ALGEBRAIC(:,91) = ( CONSTANTS(:,92).*CONSTANTS(:,93).*(CONSTANTS(:,92)+ALGEBRAIC(:,64)+CONSTANTS(:,93)+ALGEBRAIC(:,83)))./ALGEBRAIC(:,86); ALGEBRAIC(:,94) = ALGEBRAIC(:,87).*ALGEBRAIC(:,84)+ ALGEBRAIC(:,91).*ALGEBRAIC(:,68); ALGEBRAIC(:,85) = ( CONSTANTS(:,76).*CONSTANTS(:,82).*(power(ALGEBRAIC(:,82), 2.00000)+ CONSTANTS(:,81).*power(CONSTANTS(:,77), 2.00000)))./( CONSTANTS(:,74).*( CONSTANTS(:,82).*power(ALGEBRAIC(:,82), 2.00000)+ CONSTANTS(:,81).*power(CONSTANTS(:,77), 2.00000))); ALGEBRAIC(:,69) = ( CONSTANTS(:,76).*CONSTANTS(:,82).*(power(STATES(:,3), 2.00000)+ CONSTANTS(:,81).*power(CONSTANTS(:,77), 2.00000)))./( CONSTANTS(:,74).*( CONSTANTS(:,82).*power(STATES(:,3), 2.00000)+ CONSTANTS(:,81).*power(CONSTANTS(:,77), 2.00000))); ALGEBRAIC(:,96) = ( ALGEBRAIC(:,64).*ALGEBRAIC(:,85)+ CONSTANTS(:,92).*ALGEBRAIC(:,69))./(ALGEBRAIC(:,64)+CONSTANTS(:,92)); ALGEBRAIC(:,66) = ( STATES(:,3).*(ALGEBRAIC(:,63)+CONSTANTS(:,79)))./( CONSTANTS(:,73).*CONSTANTS(:,78).*(ALGEBRAIC(:,63)+1.00000)); ALGEBRAIC(:,77) = ( CONSTANTS(:,92).*ALGEBRAIC(:,66))./(ALGEBRAIC(:,64)+CONSTANTS(:,92)); ALGEBRAIC(:,67) = ( CONSTANTS(:,80).*(ALGEBRAIC(:,63)+CONSTANTS(:,79)))./( CONSTANTS(:,73).*( CONSTANTS(:,80).*ALGEBRAIC(:,63)+CONSTANTS(:,79))); ALGEBRAIC(:,78) = ALGEBRAIC(:,67); ALGEBRAIC(:,79) = ((1.00000 - STATES(:,20)) - STATES(:,21)) - STATES(:,22); RATES(:,21) = ( ALGEBRAIC(:,94).*STATES(:,20) - (ALGEBRAIC(:,96)+ALGEBRAIC(:,77)).*STATES(:,21))+ ALGEBRAIC(:,78).*ALGEBRAIC(:,79); ALGEBRAIC(:,80) = (STATES(:,3)+ (CONSTANTS(:,32)./CONSTANTS(:,31)).*STATES(:,4))./(1.00000+CONSTANTS(:,32)./CONSTANTS(:,31)); ALGEBRAIC(:,81) = ( ALGEBRAIC(:,80).*(ALGEBRAIC(:,63)+CONSTANTS(:,79)))./( CONSTANTS(:,73).*CONSTANTS(:,78).*(ALGEBRAIC(:,63)+1.00000)); ALGEBRAIC(:,88) = ( CONSTANTS(:,92).*( ALGEBRAIC(:,65).*(CONSTANTS(:,92)+CONSTANTS(:,93)+ALGEBRAIC(:,83))+ ALGEBRAIC(:,83).*ALGEBRAIC(:,64)))./ALGEBRAIC(:,86); ALGEBRAIC(:,98) = ALGEBRAIC(:,88).*ALGEBRAIC(:,81)+ ALGEBRAIC(:,91).*ALGEBRAIC(:,66); ALGEBRAIC(:,76) = ALGEBRAIC(:,67); RATES(:,20) = - (ALGEBRAIC(:,94)+ALGEBRAIC(:,98)).*STATES(:,20)+ ALGEBRAIC(:,96).*STATES(:,21)+ ALGEBRAIC(:,76).*STATES(:,22); ALGEBRAIC(:,74) = ( CONSTANTS(:,93).*ALGEBRAIC(:,68))./(CONSTANTS(:,93)+ALGEBRAIC(:,65)); ALGEBRAIC(:,75) = ALGEBRAIC(:,69); RATES(:,22) = ( ALGEBRAIC(:,98).*STATES(:,20) - (ALGEBRAIC(:,76)+ALGEBRAIC(:,74)).*STATES(:,22))+ ALGEBRAIC(:,75).*ALGEBRAIC(:,79); ALGEBRAIC(:,89) = ( ALGEBRAIC(:,64).*( ALGEBRAIC(:,83).*(ALGEBRAIC(:,64)+CONSTANTS(:,93)+ALGEBRAIC(:,65))+ ALGEBRAIC(:,65).*CONSTANTS(:,92)))./ALGEBRAIC(:,86); ALGEBRAIC(:,90) = ( CONSTANTS(:,32).*(STATES(:,4) - STATES(:,3)))./(1.00000+CONSTANTS(:,32)./CONSTANTS(:,31)); ALGEBRAIC(:,92) = piecewise({abs(ALGEBRAIC(:,21))>1.00000e-05, ( CONSTANTS(:,32).*((STATES(:,4) - STATES(:,3))+ (( (CONSTANTS(:,33)./CONSTANTS(:,31)).*ALGEBRAIC(:,21))./(1.00000 - exp( - ALGEBRAIC(:,21)))).*(STATES(:,4) - CONSTANTS(:,30).*exp( - ALGEBRAIC(:,21)))))./(1.00000+CONSTANTS(:,32)./CONSTANTS(:,31)+( (CONSTANTS(:,33)./CONSTANTS(:,31)).*ALGEBRAIC(:,21))./(1.00000 - exp( - ALGEBRAIC(:,21)))) }, ( CONSTANTS(:,32).*((STATES(:,4) - STATES(:,3))+ (( (CONSTANTS(:,33)./CONSTANTS(:,31)).*1.00000e-05)./(1.00000 - exp( - 1.00000e-05))).*(STATES(:,4) - CONSTANTS(:,30).*exp( - 1.00000e-05))))./(1.00000+CONSTANTS(:,32)./CONSTANTS(:,31)+( (CONSTANTS(:,33)./CONSTANTS(:,31)).*1.00000e-05)./(1.00000 - exp( - 1.00000e-05)))); ALGEBRAIC(:,99) = ALGEBRAIC(:,89).*ALGEBRAIC(:,92)+ ALGEBRAIC(:,90).*ALGEBRAIC(:,88); ALGEBRAIC(:,100) = ( ALGEBRAIC(:,90).*ALGEBRAIC(:,65))./(CONSTANTS(:,93)+ALGEBRAIC(:,65)); ALGEBRAIC(:,101) = ( ( STATES(:,20).*ALGEBRAIC(:,99)+ STATES(:,22).*ALGEBRAIC(:,100)).*CONSTANTS(:,34))./CONSTANTS(:,8); ALGEBRAIC(:,102) = 1.50000.*ALGEBRAIC(:,101); ALGEBRAIC(:,40) = ( CONSTANTS(:,40).*power(STATES(:,3), 2.00000))./(power(CONSTANTS(:,41), 2.00000)+power(STATES(:,3), 2.00000)); ALGEBRAIC(:,46) = CONSTANTS(:,45).*(STATES(:,4) - STATES(:,3)); RATES(:,4) = (CONSTANTS(:,10)./CONSTANTS(:,11)).*(( - ALGEBRAIC(:,102)+ALGEBRAIC(:,40)) - ALGEBRAIC(:,46)); ALGEBRAIC(:,33) = ALGEBRAIC(:,31)+ALGEBRAIC(:,32); ALGEBRAIC(:,97) = piecewise({abs(ALGEBRAIC(:,21))>1.00000e-05, ( (( CONSTANTS(:,33).*ALGEBRAIC(:,21))./(1.00000 - exp( - ALGEBRAIC(:,21)))).*(( CONSTANTS(:,30).*exp( - ALGEBRAIC(:,21)) - STATES(:,3))+ (CONSTANTS(:,32)./CONSTANTS(:,31)).*( CONSTANTS(:,30).*exp( - ALGEBRAIC(:,21)) - STATES(:,4))))./(1.00000+CONSTANTS(:,32)./CONSTANTS(:,31)+( (CONSTANTS(:,33)./CONSTANTS(:,31)).*ALGEBRAIC(:,21))./(1.00000 - exp(ALGEBRAIC(:,21)))) }, ( (( CONSTANTS(:,33).*1.00000e-05)./(1.00000 - exp( - 1.00000e-05))).*(( CONSTANTS(:,30).*exp( - 1.00000e-05) - STATES(:,3))+ (CONSTANTS(:,32)./CONSTANTS(:,31)).*( CONSTANTS(:,30).*exp( - 1.00000e-05) - STATES(:,4))))./(1.00000+CONSTANTS(:,32)./CONSTANTS(:,31)+( (CONSTANTS(:,33)./CONSTANTS(:,31)).*1.00000e-05)./(1.00000 - exp( - 1.00000e-05)))); ALGEBRAIC(:,95) = piecewise({abs(ALGEBRAIC(:,21))>1.00000e-05, ( (( CONSTANTS(:,33).*ALGEBRAIC(:,21))./(1.00000 - exp( - ALGEBRAIC(:,21)))).*( CONSTANTS(:,30).*exp( - ALGEBRAIC(:,21)) - STATES(:,3)))./(1.00000+( (CONSTANTS(:,33)./CONSTANTS(:,31)).*ALGEBRAIC(:,21))./(1.00000 - exp( - ALGEBRAIC(:,21)))) }, ( (( CONSTANTS(:,33).*1.00000e-05)./(1.00000 - exp( - 1.00000e-05))).*( CONSTANTS(:,30).*exp( - 1.00000e-05) - STATES(:,3)))./(1.00000+( (CONSTANTS(:,33)./CONSTANTS(:,31)).*1.00000e-05)./(1.00000 - exp( - 1.00000e-05)))); ALGEBRAIC(:,103) = ALGEBRAIC(:,97).*ALGEBRAIC(:,89)+ ALGEBRAIC(:,95).*ALGEBRAIC(:,87); ALGEBRAIC(:,104) = ( ALGEBRAIC(:,95).*ALGEBRAIC(:,64))./(ALGEBRAIC(:,64)+CONSTANTS(:,92)); ALGEBRAIC(:,105) = ( ( STATES(:,20).*ALGEBRAIC(:,103)+ STATES(:,21).*ALGEBRAIC(:,104)).*CONSTANTS(:,34))./CONSTANTS(:,8); ALGEBRAIC(:,106) = - 1.50000.*ALGEBRAIC(:,105).*2.00000.*CONSTANTS(:,10).*CONSTANTS(:,3); ALGEBRAIC(:,41) = ( CONSTANTS(:,42).*STATES(:,3))./(CONSTANTS(:,43)+STATES(:,3)); ALGEBRAIC(:,42) = ALGEBRAIC(:,41).*2.00000.*CONSTANTS(:,10).*CONSTANTS(:,3); ALGEBRAIC(:,43) = (( CONSTANTS(:,1).*CONSTANTS(:,2))./( 2.00000.*CONSTANTS(:,3))).*log(CONSTANTS(:,30)./STATES(:,3)); ALGEBRAIC(:,44) = CONSTANTS(:,44).*(ALGEBRAIC(:,43) - STATES(:,1)); ALGEBRAIC(:,45) = - ALGEBRAIC(:,44).*2.00000.*CONSTANTS(:,10).*CONSTANTS(:,3); RATES(:,1) = - (ALGEBRAIC(:,26).*0.00100000+ALGEBRAIC(:,28).*0.00100000+ALGEBRAIC(:,29).*0.00100000+ALGEBRAIC(:,33).*0.00100000+ALGEBRAIC(:,30).*0.00100000+ALGEBRAIC(:,34).*0.00100000+ALGEBRAIC(:,36).*0.00100000+ALGEBRAIC(:,22)+ALGEBRAIC(:,1)+ALGEBRAIC(:,45)+ALGEBRAIC(:,39)+ALGEBRAIC(:,42)+ALGEBRAIC(:,106))./CONSTANTS(:,4); ALGEBRAIC(:,47) = power(1.00000+( CONSTANTS(:,46).*CONSTANTS(:,47))./power(CONSTANTS(:,46)+STATES(:,3), 2.00000), - 1.00000); RATES(:,3) = ALGEBRAIC(:,47).*(((ALGEBRAIC(:,102) - ALGEBRAIC(:,40))+ALGEBRAIC(:,46)+ALGEBRAIC(:,62)) - ( - 2.00000.*ALGEBRAIC(:,39)+ALGEBRAIC(:,42)+ALGEBRAIC(:,45)+ALGEBRAIC(:,106))./( 2.00000.*CONSTANTS(:,10).*CONSTANTS(:,3))); 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) = 1.00000./(1.00000+exp((STATES(:,1)+87.5000)./10.3000)); ALGEBRAIC(:,2) = 1.00000./(1.00000+exp((STATES(:,1)+45.0000)./ - 6.50000)); ALGEBRAIC(:,13) = 0.00136000./(( 0.320000.*(STATES(:,1)+47.1300))./(1.00000 - exp( - 0.100000.*(STATES(:,1)+47.1300)))+ 0.0800000.*exp( - STATES(:,1)./11.0000)); ALGEBRAIC(:,3) = 1.00000./(1.00000+exp((STATES(:,1)+76.1000)./6.07000)); ALGEBRAIC(:,14) = piecewise({STATES(:,1)>= - 40.0000, 0.000453700.*(1.00000+exp( - (STATES(:,1)+10.6600)./11.1000)) }, 0.00349000./( 0.135000.*exp( - (STATES(:,1)+80.0000)./6.80000)+ 3.56000.*exp( 0.0790000.*STATES(:,1))+ 310000..*exp( 0.350000.*STATES(:,1)))); ALGEBRAIC(:,4) = 1.00000./(1.00000+exp((STATES(:,1)+76.1000)./6.07000)); ALGEBRAIC(:,15) = piecewise({STATES(:,1)>= - 40.0000, ( 0.0116300.*(1.00000+exp( - 0.100000.*(STATES(:,1)+32.0000))))./exp( - 2.53500e-07.*STATES(:,1)) }, 0.00349000./( ((STATES(:,1)+37.7800)./(1.00000+exp( 0.311000.*(STATES(:,1)+79.2300)))).*( - 127140..*exp( 0.244400.*STATES(:,1)) - 3.47400e-05.*exp( - 0.0439100.*STATES(:,1)))+( 0.121200.*exp( - 0.0105200.*STATES(:,1)))./(1.00000+exp( - 0.137800.*(STATES(:,1)+40.1400))))); ALGEBRAIC(:,16) = 1.00000./( 45.1600.*exp( 0.0357700.*(STATES(:,1)+50.0000))+ 98.9000.*exp( - 0.100000.*(STATES(:,1)+38.0000))); ALGEBRAIC(:,5) = 1.00000./(1.00000+exp((STATES(:,1)+10.6000)./ - 11.4200)); ALGEBRAIC(:,17) = 0.550000.*exp( - power((STATES(:,1)+70.0000)./25.0000, 2.00000))+0.0490000; ALGEBRAIC(:,6) = 1.00000./(1.00000+exp((STATES(:,1)+45.3000)./6.88410)); ALGEBRAIC(:,18) = 3.30000.*exp(( ( - (STATES(:,1)+70.0000)./30.0000).*(STATES(:,1)+70.0000))./30.0000)+0.0490000; ALGEBRAIC(:,7) = 1.00000./(1.00000+exp((STATES(:,1)+45.3000)./6.88410)); ALGEBRAIC(:,19) = 10.0000./( 45.1600.*exp( 0.0357700.*(STATES(:,1)+50.0000))+ 98.9000.*exp( - 0.100000.*(STATES(:,1)+38.0000))); ALGEBRAIC(:,8) = 1.00000./(1.00000+exp((STATES(:,1)+11.5000)./ - 11.8200)); ALGEBRAIC(:,20) = 1.00000./( 0.118850.*exp((STATES(:,1)+80.0000)./28.3700)+ 0.562300.*exp((STATES(:,1)+80.0000)./ - 14.1900)); ALGEBRAIC(:,10) = 1.00000./(1.00000+exp((STATES(:,1)+138.600)./10.4800)); ALGEBRAIC(:,1) = piecewise({VOI - floor(VOI./CONSTANTS(:,5)).*CONSTANTS(:,5)>=0.00000&VOI - floor(VOI./CONSTANTS(:,5)).*CONSTANTS(:,5)<=CONSTANTS(:,6), CONSTANTS(:,7) }, 0.00000); ALGEBRAIC(:,27) = (( CONSTANTS(:,1).*CONSTANTS(:,2))./CONSTANTS(:,3)).*log(CONSTANTS(:,15)./STATES(:,5)); ALGEBRAIC(:,28) = CONSTANTS(:,85).*STATES(:,10).*( CONSTANTS(:,20).*STATES(:,11)+ CONSTANTS(:,21).*STATES(:,12)).*(STATES(:,1) - ALGEBRAIC(:,27)); ALGEBRAIC(:,29) = CONSTANTS(:,22).*STATES(:,13).*STATES(:,14).*(STATES(:,1) - ALGEBRAIC(:,27)); ALGEBRAIC(:,30) = ( (48.0000./(exp((STATES(:,1)+37.0000)./25.0000)+exp((STATES(:,1)+37.0000)./ - 25.0000))+10.0000).*0.00100000)./(1.00000+exp((STATES(:,1) - (ALGEBRAIC(:,27)+76.7700))./ - 17.0000))+( CONSTANTS(:,23).*(STATES(:,1) - (ALGEBRAIC(:,27)+1.73000)))./( (1.00000+exp(( 1.61300.*CONSTANTS(:,3).*(STATES(:,1) - (ALGEBRAIC(:,27)+1.73000)))./( CONSTANTS(:,1).*CONSTANTS(:,2)))).*(1.00000+exp((CONSTANTS(:,15) - 0.998800)./ - 0.124000))); ALGEBRAIC(:,36) = CONSTANTS(:,28).*(STATES(:,1) - ALGEBRAIC(:,27)); ALGEBRAIC(:,22) = ( (( (( CONSTANTS(:,12).*1.00000)./(1.00000+ 0.124500.*exp(( - 0.100000.*STATES(:,1).*CONSTANTS(:,3))./( CONSTANTS(:,1).*CONSTANTS(:,2)))+ 0.0365000.*CONSTANTS(:,83).*exp(( - STATES(:,1).*CONSTANTS(:,3))./( CONSTANTS(:,1).*CONSTANTS(:,2))))).*CONSTANTS(:,15))./(CONSTANTS(:,15)+CONSTANTS(:,13))).*1.00000)./(1.00000+power(CONSTANTS(:,14)./STATES(:,2), 4.00000)); ALGEBRAIC(:,32) = CONSTANTS(:,24).*STATES(:,15).*CONSTANTS(:,86).*(STATES(:,1) - ALGEBRAIC(:,27)); ALGEBRAIC(:,25) = (( CONSTANTS(:,1).*CONSTANTS(:,2))./CONSTANTS(:,3)).*log(CONSTANTS(:,16)./STATES(:,2)); ALGEBRAIC(:,26) = CONSTANTS(:,84).*power(STATES(:,7), 3.00000).*STATES(:,8).*STATES(:,9).*(STATES(:,1) - ALGEBRAIC(:,25)); ALGEBRAIC(:,34) = CONSTANTS(:,26).*(STATES(:,1) - ALGEBRAIC(:,25)); ALGEBRAIC(:,12) = ( CONSTANTS(:,3).*STATES(:,1))./( CONSTANTS(:,1).*CONSTANTS(:,2)); ALGEBRAIC(:,38) = ( CONSTANTS(:,39).*( exp( CONSTANTS(:,37).*ALGEBRAIC(:,12)).*power(STATES(:,2), 3.00000).*CONSTANTS(:,30) - exp( (CONSTANTS(:,37) - 1.00000).*ALGEBRAIC(:,12)).*power(CONSTANTS(:,16), 3.00000).*STATES(:,3)))./( (power(CONSTANTS(:,16), 3.00000)+power(CONSTANTS(:,35), 3.00000)).*(CONSTANTS(:,30)+CONSTANTS(:,36)).*(1.00000+ CONSTANTS(:,38).*exp( (CONSTANTS(:,37) - 1.00000).*ALGEBRAIC(:,12)))); ALGEBRAIC(:,39) = ALGEBRAIC(:,38).*CONSTANTS(:,10).*CONSTANTS(:,3); ALGEBRAIC(:,31) = CONSTANTS(:,24).*STATES(:,15).*CONSTANTS(:,25).*(STATES(:,1) - ALGEBRAIC(:,25)); ALGEBRAIC(:,24) = CONSTANTS(:,17) - STATES(:,6); ALGEBRAIC(:,49) = piecewise({VOI>300000., 1.00000 }, 1.00000); ALGEBRAIC(:,50) = piecewise({ALGEBRAIC(:,49)>0.800000&ALGEBRAIC(:,49)<=1.15000, ALGEBRAIC(:,49) , ALGEBRAIC(:,49)>1.15000, 1.15000 }, 0.800000); ALGEBRAIC(:,52) = CONSTANTS(:,57).*(1.00000+ CONSTANTS(:,59).*(ALGEBRAIC(:,50) - 1.00000)); ALGEBRAIC(:,53) = ( ALGEBRAIC(:,52).*CONSTANTS(:,17))./(ALGEBRAIC(:,52)+ (CONSTANTS(:,49)./CONSTANTS(:,48)).*(1.00000 - ( (1.00000+ CONSTANTS(:,60).*(ALGEBRAIC(:,50) - 1.00000)).*0.500000)./CONSTANTS(:,50))); ALGEBRAIC(:,54) = CONSTANTS(:,51).*power(ALGEBRAIC(:,24)./ALGEBRAIC(:,53), CONSTANTS(:,56)); ALGEBRAIC(:,48) = CONSTANTS(:,52)+( CONSTANTS(:,53).*power(STATES(:,16), CONSTANTS(:,54) - 1.00000))./(power(STATES(:,16), CONSTANTS(:,54))+power(CONSTANTS(:,55), CONSTANTS(:,54))); ALGEBRAIC(:,56) = 1.00000+ CONSTANTS(:,60).*(ALGEBRAIC(:,50) - 1.00000); ALGEBRAIC(:,55) = (CONSTANTS(:,51)./power(ALGEBRAIC(:,53)./CONSTANTS(:,17), CONSTANTS(:,56)) - CONSTANTS(:,87))./(CONSTANTS(:,52)+CONSTANTS(:,91)+CONSTANTS(:,51)./power(ALGEBRAIC(:,53)./CONSTANTS(:,17), CONSTANTS(:,56))); ALGEBRAIC(:,57) = ( CONSTANTS(:,61).*STATES(:,16))./ALGEBRAIC(:,55); ALGEBRAIC(:,58) = ALGEBRAIC(:,57).*ALGEBRAIC(:,56); ALGEBRAIC(:,59) = STATES(:,17)+STATES(:,18)+STATES(:,19); ALGEBRAIC(:,60) = piecewise({ALGEBRAIC(:,59)<0.00000, ( ALGEBRAIC(:,58).*( CONSTANTS(:,62).*ALGEBRAIC(:,59)+1.00000))./(1.00000 - ALGEBRAIC(:,59)) }, ( ALGEBRAIC(:,58).*(1.00000+ (CONSTANTS(:,62)+2.00000).*ALGEBRAIC(:,59)))./(1.00000+ALGEBRAIC(:,59))); ALGEBRAIC(:,61) = piecewise({1.00000 - ALGEBRAIC(:,60)./( CONSTANTS(:,50).*CONSTANTS(:,61))>0.100000, CONSTANTS(:,49).*(1.00000 - ALGEBRAIC(:,60)./( CONSTANTS(:,50).*CONSTANTS(:,61))) }, CONSTANTS(:,49).*0.100000); ALGEBRAIC(:,62) = (CONSTANTS(:,17) - STATES(:,6)).*ALGEBRAIC(:,61) - STATES(:,3).*STATES(:,6).*CONSTANTS(:,48); ALGEBRAIC(:,21) = 2.00000.*ALGEBRAIC(:,12); ALGEBRAIC(:,82) = piecewise({abs(ALGEBRAIC(:,21))>1.00000e-09, (STATES(:,3)+( (CONSTANTS(:,33)./CONSTANTS(:,31)).*CONSTANTS(:,30).*ALGEBRAIC(:,21).*exp( - ALGEBRAIC(:,21)))./(1.00000 - exp( - ALGEBRAIC(:,21))))./(1.00000+( (CONSTANTS(:,33)./CONSTANTS(:,31)).*ALGEBRAIC(:,21))./(1.00000 - exp( - ALGEBRAIC(:,21)))) }, (STATES(:,3)+ (CONSTANTS(:,33)./CONSTANTS(:,31)).*CONSTANTS(:,30))./(1.00000+CONSTANTS(:,33)./CONSTANTS(:,31))); ALGEBRAIC(:,84) = (power(ALGEBRAIC(:,82), 2.00000)+ CONSTANTS(:,81).*power(CONSTANTS(:,77), 2.00000))./( CONSTANTS(:,74).*(power(ALGEBRAIC(:,82), 2.00000)+power(CONSTANTS(:,77), 2.00000))); ALGEBRAIC(:,68) = (power(STATES(:,3), 2.00000)+ CONSTANTS(:,81).*power(CONSTANTS(:,77), 2.00000))./( CONSTANTS(:,74).*(power(STATES(:,3), 2.00000)+power(CONSTANTS(:,77), 2.00000))); ALGEBRAIC(:,63) = exp((STATES(:,1) - CONSTANTS(:,69))./CONSTANTS(:,70)); ALGEBRAIC(:,64) = ALGEBRAIC(:,63)./( CONSTANTS(:,72).*(ALGEBRAIC(:,63)+1.00000)); ALGEBRAIC(:,65) = power(STATES(:,3), 2.00000)./( CONSTANTS(:,90).*(power(STATES(:,3), 2.00000)+power(CONSTANTS(:,77), 2.00000))); ALGEBRAIC(:,83) = power(ALGEBRAIC(:,82), 2.00000)./( CONSTANTS(:,90).*(power(ALGEBRAIC(:,82), 2.00000)+power(CONSTANTS(:,77), 2.00000))); ALGEBRAIC(:,86) = (ALGEBRAIC(:,64)+CONSTANTS(:,92)).*( (CONSTANTS(:,92)+CONSTANTS(:,93)+ALGEBRAIC(:,83)).*(CONSTANTS(:,93)+ALGEBRAIC(:,65))+ ALGEBRAIC(:,64).*(CONSTANTS(:,93)+ALGEBRAIC(:,83))); ALGEBRAIC(:,87) = ( ALGEBRAIC(:,64).*CONSTANTS(:,93).*(ALGEBRAIC(:,64)+CONSTANTS(:,92)+CONSTANTS(:,93)+ALGEBRAIC(:,65)))./ALGEBRAIC(:,86); ALGEBRAIC(:,91) = ( CONSTANTS(:,92).*CONSTANTS(:,93).*(CONSTANTS(:,92)+ALGEBRAIC(:,64)+CONSTANTS(:,93)+ALGEBRAIC(:,83)))./ALGEBRAIC(:,86); ALGEBRAIC(:,94) = ALGEBRAIC(:,87).*ALGEBRAIC(:,84)+ ALGEBRAIC(:,91).*ALGEBRAIC(:,68); ALGEBRAIC(:,85) = ( CONSTANTS(:,76).*CONSTANTS(:,82).*(power(ALGEBRAIC(:,82), 2.00000)+ CONSTANTS(:,81).*power(CONSTANTS(:,77), 2.00000)))./( CONSTANTS(:,74).*( CONSTANTS(:,82).*power(ALGEBRAIC(:,82), 2.00000)+ CONSTANTS(:,81).*power(CONSTANTS(:,77), 2.00000))); ALGEBRAIC(:,69) = ( CONSTANTS(:,76).*CONSTANTS(:,82).*(power(STATES(:,3), 2.00000)+ CONSTANTS(:,81).*power(CONSTANTS(:,77), 2.00000)))./( CONSTANTS(:,74).*( CONSTANTS(:,82).*power(STATES(:,3), 2.00000)+ CONSTANTS(:,81).*power(CONSTANTS(:,77), 2.00000))); ALGEBRAIC(:,96) = ( ALGEBRAIC(:,64).*ALGEBRAIC(:,85)+ CONSTANTS(:,92).*ALGEBRAIC(:,69))./(ALGEBRAIC(:,64)+CONSTANTS(:,92)); ALGEBRAIC(:,66) = ( STATES(:,3).*(ALGEBRAIC(:,63)+CONSTANTS(:,79)))./( CONSTANTS(:,73).*CONSTANTS(:,78).*(ALGEBRAIC(:,63)+1.00000)); ALGEBRAIC(:,77) = ( CONSTANTS(:,92).*ALGEBRAIC(:,66))./(ALGEBRAIC(:,64)+CONSTANTS(:,92)); ALGEBRAIC(:,67) = ( CONSTANTS(:,80).*(ALGEBRAIC(:,63)+CONSTANTS(:,79)))./( CONSTANTS(:,73).*( CONSTANTS(:,80).*ALGEBRAIC(:,63)+CONSTANTS(:,79))); ALGEBRAIC(:,78) = ALGEBRAIC(:,67); ALGEBRAIC(:,79) = ((1.00000 - STATES(:,20)) - STATES(:,21)) - STATES(:,22); ALGEBRAIC(:,80) = (STATES(:,3)+ (CONSTANTS(:,32)./CONSTANTS(:,31)).*STATES(:,4))./(1.00000+CONSTANTS(:,32)./CONSTANTS(:,31)); ALGEBRAIC(:,81) = ( ALGEBRAIC(:,80).*(ALGEBRAIC(:,63)+CONSTANTS(:,79)))./( CONSTANTS(:,73).*CONSTANTS(:,78).*(ALGEBRAIC(:,63)+1.00000)); ALGEBRAIC(:,88) = ( CONSTANTS(:,92).*( ALGEBRAIC(:,65).*(CONSTANTS(:,92)+CONSTANTS(:,93)+ALGEBRAIC(:,83))+ ALGEBRAIC(:,83).*ALGEBRAIC(:,64)))./ALGEBRAIC(:,86); ALGEBRAIC(:,98) = ALGEBRAIC(:,88).*ALGEBRAIC(:,81)+ ALGEBRAIC(:,91).*ALGEBRAIC(:,66); ALGEBRAIC(:,76) = ALGEBRAIC(:,67); ALGEBRAIC(:,74) = ( CONSTANTS(:,93).*ALGEBRAIC(:,68))./(CONSTANTS(:,93)+ALGEBRAIC(:,65)); ALGEBRAIC(:,75) = ALGEBRAIC(:,69); ALGEBRAIC(:,89) = ( ALGEBRAIC(:,64).*( ALGEBRAIC(:,83).*(ALGEBRAIC(:,64)+CONSTANTS(:,93)+ALGEBRAIC(:,65))+ ALGEBRAIC(:,65).*CONSTANTS(:,92)))./ALGEBRAIC(:,86); ALGEBRAIC(:,90) = ( CONSTANTS(:,32).*(STATES(:,4) - STATES(:,3)))./(1.00000+CONSTANTS(:,32)./CONSTANTS(:,31)); ALGEBRAIC(:,92) = piecewise({abs(ALGEBRAIC(:,21))>1.00000e-05, ( CONSTANTS(:,32).*((STATES(:,4) - STATES(:,3))+ (( (CONSTANTS(:,33)./CONSTANTS(:,31)).*ALGEBRAIC(:,21))./(1.00000 - exp( - ALGEBRAIC(:,21)))).*(STATES(:,4) - CONSTANTS(:,30).*exp( - ALGEBRAIC(:,21)))))./(1.00000+CONSTANTS(:,32)./CONSTANTS(:,31)+( (CONSTANTS(:,33)./CONSTANTS(:,31)).*ALGEBRAIC(:,21))./(1.00000 - exp( - ALGEBRAIC(:,21)))) }, ( CONSTANTS(:,32).*((STATES(:,4) - STATES(:,3))+ (( (CONSTANTS(:,33)./CONSTANTS(:,31)).*1.00000e-05)./(1.00000 - exp( - 1.00000e-05))).*(STATES(:,4) - CONSTANTS(:,30).*exp( - 1.00000e-05))))./(1.00000+CONSTANTS(:,32)./CONSTANTS(:,31)+( (CONSTANTS(:,33)./CONSTANTS(:,31)).*1.00000e-05)./(1.00000 - exp( - 1.00000e-05)))); ALGEBRAIC(:,99) = ALGEBRAIC(:,89).*ALGEBRAIC(:,92)+ ALGEBRAIC(:,90).*ALGEBRAIC(:,88); ALGEBRAIC(:,100) = ( ALGEBRAIC(:,90).*ALGEBRAIC(:,65))./(CONSTANTS(:,93)+ALGEBRAIC(:,65)); ALGEBRAIC(:,101) = ( ( STATES(:,20).*ALGEBRAIC(:,99)+ STATES(:,22).*ALGEBRAIC(:,100)).*CONSTANTS(:,34))./CONSTANTS(:,8); ALGEBRAIC(:,102) = 1.50000.*ALGEBRAIC(:,101); ALGEBRAIC(:,40) = ( CONSTANTS(:,40).*power(STATES(:,3), 2.00000))./(power(CONSTANTS(:,41), 2.00000)+power(STATES(:,3), 2.00000)); ALGEBRAIC(:,46) = CONSTANTS(:,45).*(STATES(:,4) - STATES(:,3)); ALGEBRAIC(:,33) = ALGEBRAIC(:,31)+ALGEBRAIC(:,32); ALGEBRAIC(:,97) = piecewise({abs(ALGEBRAIC(:,21))>1.00000e-05, ( (( CONSTANTS(:,33).*ALGEBRAIC(:,21))./(1.00000 - exp( - ALGEBRAIC(:,21)))).*(( CONSTANTS(:,30).*exp( - ALGEBRAIC(:,21)) - STATES(:,3))+ (CONSTANTS(:,32)./CONSTANTS(:,31)).*( CONSTANTS(:,30).*exp( - ALGEBRAIC(:,21)) - STATES(:,4))))./(1.00000+CONSTANTS(:,32)./CONSTANTS(:,31)+( (CONSTANTS(:,33)./CONSTANTS(:,31)).*ALGEBRAIC(:,21))./(1.00000 - exp(ALGEBRAIC(:,21)))) }, ( (( CONSTANTS(:,33).*1.00000e-05)./(1.00000 - exp( - 1.00000e-05))).*(( CONSTANTS(:,30).*exp( - 1.00000e-05) - STATES(:,3))+ (CONSTANTS(:,32)./CONSTANTS(:,31)).*( CONSTANTS(:,30).*exp( - 1.00000e-05) - STATES(:,4))))./(1.00000+CONSTANTS(:,32)./CONSTANTS(:,31)+( (CONSTANTS(:,33)./CONSTANTS(:,31)).*1.00000e-05)./(1.00000 - exp( - 1.00000e-05)))); ALGEBRAIC(:,95) = piecewise({abs(ALGEBRAIC(:,21))>1.00000e-05, ( (( CONSTANTS(:,33).*ALGEBRAIC(:,21))./(1.00000 - exp( - ALGEBRAIC(:,21)))).*( CONSTANTS(:,30).*exp( - ALGEBRAIC(:,21)) - STATES(:,3)))./(1.00000+( (CONSTANTS(:,33)./CONSTANTS(:,31)).*ALGEBRAIC(:,21))./(1.00000 - exp( - ALGEBRAIC(:,21)))) }, ( (( CONSTANTS(:,33).*1.00000e-05)./(1.00000 - exp( - 1.00000e-05))).*( CONSTANTS(:,30).*exp( - 1.00000e-05) - STATES(:,3)))./(1.00000+( (CONSTANTS(:,33)./CONSTANTS(:,31)).*1.00000e-05)./(1.00000 - exp( - 1.00000e-05)))); ALGEBRAIC(:,103) = ALGEBRAIC(:,97).*ALGEBRAIC(:,89)+ ALGEBRAIC(:,95).*ALGEBRAIC(:,87); ALGEBRAIC(:,104) = ( ALGEBRAIC(:,95).*ALGEBRAIC(:,64))./(ALGEBRAIC(:,64)+CONSTANTS(:,92)); ALGEBRAIC(:,105) = ( ( STATES(:,20).*ALGEBRAIC(:,103)+ STATES(:,21).*ALGEBRAIC(:,104)).*CONSTANTS(:,34))./CONSTANTS(:,8); ALGEBRAIC(:,106) = - 1.50000.*ALGEBRAIC(:,105).*2.00000.*CONSTANTS(:,10).*CONSTANTS(:,3); ALGEBRAIC(:,41) = ( CONSTANTS(:,42).*STATES(:,3))./(CONSTANTS(:,43)+STATES(:,3)); ALGEBRAIC(:,42) = ALGEBRAIC(:,41).*2.00000.*CONSTANTS(:,10).*CONSTANTS(:,3); ALGEBRAIC(:,43) = (( CONSTANTS(:,1).*CONSTANTS(:,2))./( 2.00000.*CONSTANTS(:,3))).*log(CONSTANTS(:,30)./STATES(:,3)); ALGEBRAIC(:,44) = CONSTANTS(:,44).*(ALGEBRAIC(:,43) - STATES(:,1)); ALGEBRAIC(:,45) = - ALGEBRAIC(:,44).*2.00000.*CONSTANTS(:,10).*CONSTANTS(:,3); ALGEBRAIC(:,47) = power(1.00000+( CONSTANTS(:,46).*CONSTANTS(:,47))./power(CONSTANTS(:,46)+STATES(:,3), 2.00000), - 1.00000); ALGEBRAIC(:,11) = STATES(:,3); ALGEBRAIC(:,23) = piecewise({abs(ALGEBRAIC(:,21))>1.00000e-09, (STATES(:,3)+ (CONSTANTS(:,32)./CONSTANTS(:,31)).*STATES(:,4)+( (CONSTANTS(:,33)./CONSTANTS(:,31)).*CONSTANTS(:,30).*ALGEBRAIC(:,21).*exp( - ALGEBRAIC(:,21)))./(1.00000 - exp( - ALGEBRAIC(:,21))))./(1.00000+CONSTANTS(:,32)./CONSTANTS(:,31)+( (CONSTANTS(:,33)./CONSTANTS(:,31)).*ALGEBRAIC(:,21))./(1.00000 - exp( - ALGEBRAIC(:,21)))) }, (STATES(:,3)+ (CONSTANTS(:,32)./CONSTANTS(:,31)).*STATES(:,4)+ (CONSTANTS(:,33)./CONSTANTS(:,31)).*CONSTANTS(:,30))./(1.00000+CONSTANTS(:,32)./CONSTANTS(:,31)+CONSTANTS(:,33)./CONSTANTS(:,31))); ALGEBRAIC(:,35) = CONSTANTS(:,27).*(STATES(:,1) - CONSTANTS(:,29)); ALGEBRAIC(:,37) = ALGEBRAIC(:,34)+ALGEBRAIC(:,35)+ALGEBRAIC(:,36); ALGEBRAIC(:,51) = ALGEBRAIC(:,49); ALGEBRAIC(:,70) = CONSTANTS(:,92)./(ALGEBRAIC(:,64)+CONSTANTS(:,92)); ALGEBRAIC(:,71) = ALGEBRAIC(:,64)./(ALGEBRAIC(:,64)+CONSTANTS(:,92)); ALGEBRAIC(:,72) = CONSTANTS(:,93)./(ALGEBRAIC(:,65)+CONSTANTS(:,93)); ALGEBRAIC(:,73) = ALGEBRAIC(:,65)./(ALGEBRAIC(:,65)+CONSTANTS(:,93)); ALGEBRAIC(:,93) = (((((((1.00000 - ALGEBRAIC(:,87)) - ALGEBRAIC(:,88)) - ALGEBRAIC(:,89)) - ALGEBRAIC(:,91)) - ALGEBRAIC(:,70)) - ALGEBRAIC(:,72)) - ALGEBRAIC(:,71)) - ALGEBRAIC(:,73); 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