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 =30; end % There are a total of 14 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 (minute)'); LEGEND_STATES(:,1) = strpad('CycA in component CycA (dimensionless)'); LEGEND_CONSTANTS(:,1) = strpad('k_assa in component kinetic_parameters (first_order_rate_constant)'); LEGEND_CONSTANTS(:,2) = strpad('k_dissa in component kinetic_parameters (first_order_rate_constant)'); LEGEND_ALGEBRAIC(:,21) = strpad('V_di in component V_di (first_order_rate_constant)'); LEGEND_ALGEBRAIC(:,22) = strpad('V_sa in component V_sa (first_order_rate_constant)'); LEGEND_ALGEBRAIC(:,15) = strpad('V_da in component V_da (first_order_rate_constant)'); LEGEND_STATES(:,2) = strpad('Tri_A in component Tri_A (dimensionless)'); LEGEND_STATES(:,3) = strpad('CKI in component CKI (dimensionless)'); LEGEND_STATES(:,4) = strpad('CycB in component CycB (dimensionless)'); LEGEND_CONSTANTS(:,3) = strpad('k_assb in component kinetic_parameters (first_order_rate_constant)'); LEGEND_CONSTANTS(:,4) = strpad('k_dissb in component kinetic_parameters (first_order_rate_constant)'); LEGEND_ALGEBRAIC(:,25) = strpad('V_sb in component V_sb (first_order_rate_constant)'); LEGEND_ALGEBRAIC(:,26) = strpad('V_db in component V_db (first_order_rate_constant)'); LEGEND_ALGEBRAIC(:,30) = strpad('V_25 in component V_25 (first_order_rate_constant)'); LEGEND_ALGEBRAIC(:,28) = strpad('V_wee in component V_wee (first_order_rate_constant)'); LEGEND_STATES(:,5) = strpad('pB in component pB (dimensionless)'); LEGEND_STATES(:,6) = strpad('BCKI in component BCKI (dimensionless)'); LEGEND_STATES(:,7) = strpad('CycE in component CycE (dimensionless)'); LEGEND_CONSTANTS(:,5) = strpad('k_disse in component kinetic_parameters (first_order_rate_constant)'); LEGEND_CONSTANTS(:,6) = strpad('k_asse in component kinetic_parameters (first_order_rate_constant)'); LEGEND_ALGEBRAIC(:,24) = strpad('V_se in component V_se (first_order_rate_constant)'); LEGEND_ALGEBRAIC(:,14) = strpad('V_de in component V_de (first_order_rate_constant)'); LEGEND_STATES(:,8) = strpad('Tri_E in component Tri_E (dimensionless)'); LEGEND_ALGEBRAIC(:,2) = strpad('CycD in component CycD (dimensionless)'); LEGEND_CONSTANTS(:,7) = strpad('CycD_0 in component CycD (dimensionless)'); LEGEND_STATES(:,9) = strpad('mass in component mass (dimensionless)'); LEGEND_STATES(:,10) = strpad('Cdc20_A in component Cdc20_A (dimensionless)'); LEGEND_CONSTANTS(:,8) = strpad('k_a20 in component kinetic_parameters (first_order_rate_constant)'); LEGEND_CONSTANTS(:,9) = strpad('k_i20 in component kinetic_parameters (first_order_rate_constant)'); LEGEND_CONSTANTS(:,10) = strpad('k_d20 in component kinetic_parameters (first_order_rate_constant)'); LEGEND_STATES(:,11) = strpad('APCP in component APCP (dimensionless)'); LEGEND_STATES(:,12) = strpad('Cdc20_i in component Cdc20_i (dimensionless)'); LEGEND_CONSTANTS(:,11) = strpad('J_a20 in component Cdc20_A (dimensionless)'); LEGEND_CONSTANTS(:,12) = strpad('J_i20 in component Cdc20_A (dimensionless)'); LEGEND_CONSTANTS(:,13) = strpad('k_s20p in component kinetic_parameters (first_order_rate_constant)'); LEGEND_CONSTANTS(:,14) = strpad('k_s20pp in component kinetic_parameters (first_order_rate_constant)'); LEGEND_CONSTANTS(:,15) = strpad('n20 in component Cdc20_i (dimensionless)'); LEGEND_CONSTANTS(:,16) = strpad('J_20 in component Cdc20_i (dimensionless)'); LEGEND_CONSTANTS(:,17) = strpad('J_a20 in component Cdc20_i (dimensionless)'); LEGEND_CONSTANTS(:,18) = strpad('J_i20 in component Cdc20_i (dimensionless)'); LEGEND_ALGEBRAIC(:,1) = strpad('APC in component APC (dimensionless)'); LEGEND_CONSTANTS(:,19) = strpad('APC_T in component APC (dimensionless)'); LEGEND_CONSTANTS(:,20) = strpad('k_aie in component kinetic_parameters (first_order_rate_constant)'); LEGEND_CONSTANTS(:,21) = strpad('k_iie in component kinetic_parameters (first_order_rate_constant)'); LEGEND_CONSTANTS(:,22) = strpad('J_aie in component APCP (dimensionless)'); LEGEND_CONSTANTS(:,23) = strpad('J_iie in component APCP (dimensionless)'); LEGEND_STATES(:,13) = strpad('pBCKI in component pBCKI (dimensionless)'); LEGEND_ALGEBRAIC(:,19) = strpad('V_si in component V_si (first_order_rate_constant)'); LEGEND_ALGEBRAIC(:,10) = strpad('Cdh1_i in component Cdh1_i (dimensionless)'); LEGEND_CONSTANTS(:,24) = strpad('Cdh1_T in component Cdh1_i (dimensionless)'); LEGEND_STATES(:,14) = strpad('Cdh1 in component Cdh1 (dimensionless)'); LEGEND_ALGEBRAIC(:,18) = strpad('V_ah1 in component V_ah1 (first_order_rate_constant)'); LEGEND_ALGEBRAIC(:,20) = strpad('V_ih1 in component V_ih1 (first_order_rate_constant)'); LEGEND_CONSTANTS(:,25) = strpad('J_ah1 in component Cdh1 (dimensionless)'); LEGEND_CONSTANTS(:,26) = strpad('J_ih1 in component Cdh1 (dimensionless)'); LEGEND_CONSTANTS(:,27) = strpad('mu in component mass (first_order_rate_constant)'); LEGEND_CONSTANTS(:,28) = strpad('maxmass in component mass (dimensionless)'); LEGEND_ALGEBRAIC(:,11) = strpad('V_atf in component V_atf (first_order_rate_constant)'); LEGEND_CONSTANTS(:,29) = strpad('k_atfp in component kinetic_parameters (first_order_rate_constant)'); LEGEND_CONSTANTS(:,30) = strpad('k_atfapp in component kinetic_parameters (first_order_rate_constant)'); LEGEND_CONSTANTS(:,31) = strpad('k_atfepp in component kinetic_parameters (first_order_rate_constant)'); LEGEND_CONSTANTS(:,32) = strpad('k_atfdpp in component kinetic_parameters (first_order_rate_constant)'); LEGEND_ALGEBRAIC(:,12) = strpad('V_itf in component V_itf (first_order_rate_constant)'); LEGEND_CONSTANTS(:,33) = strpad('k_itfp in component kinetic_parameters (first_order_rate_constant)'); LEGEND_CONSTANTS(:,34) = strpad('k_itfapp in component kinetic_parameters (first_order_rate_constant)'); LEGEND_CONSTANTS(:,35) = strpad('k_itfbpp in component kinetic_parameters (first_order_rate_constant)'); LEGEND_ALGEBRAIC(:,13) = strpad('TF_E in component TF_E (dimensionless)'); LEGEND_CONSTANTS(:,36) = strpad('J_itf in component TF_E (dimensionless)'); LEGEND_CONSTANTS(:,37) = strpad('J_atf in component TF_E (dimensionless)'); LEGEND_CONSTANTS(:,38) = strpad('k_dep in component kinetic_parameters (first_order_rate_constant)'); LEGEND_CONSTANTS(:,39) = strpad('k_deepp in component kinetic_parameters (first_order_rate_constant)'); LEGEND_CONSTANTS(:,40) = strpad('k_deapp in component kinetic_parameters (first_order_rate_constant)'); LEGEND_CONSTANTS(:,41) = strpad('k_debpp in component kinetic_parameters (first_order_rate_constant)'); LEGEND_CONSTANTS(:,42) = strpad('k_dap in component kinetic_parameters (first_order_rate_constant)'); LEGEND_CONSTANTS(:,43) = strpad('k_dapp in component kinetic_parameters (first_order_rate_constant)'); LEGEND_CONSTANTS(:,44) = strpad('k_dappp in component kinetic_parameters (first_order_rate_constant)'); LEGEND_ALGEBRAIC(:,17) = strpad('TF_I in component TF_I (dimensionless)'); LEGEND_CONSTANTS(:,45) = strpad('k_afi in component kinetic_parameters (first_order_rate_constant)'); LEGEND_CONSTANTS(:,46) = strpad('k_ifip in component kinetic_parameters (first_order_rate_constant)'); LEGEND_CONSTANTS(:,47) = strpad('k_ifibpp in component kinetic_parameters (first_order_rate_constant)'); LEGEND_CONSTANTS(:,48) = strpad('J_ifi in component TF_I (dimensionless)'); LEGEND_CONSTANTS(:,49) = strpad('J_afi in component TF_I (dimensionless)'); LEGEND_ALGEBRAIC(:,16) = strpad('Cdc14 in component TF_I (dimensionless)'); LEGEND_CONSTANTS(:,50) = strpad('k_ah1p in component kinetic_parameters (first_order_rate_constant)'); LEGEND_CONSTANTS(:,51) = strpad('k_ah1pp in component kinetic_parameters (first_order_rate_constant)'); LEGEND_CONSTANTS(:,52) = strpad('k_ih1p in component kinetic_parameters (first_order_rate_constant)'); LEGEND_CONSTANTS(:,53) = strpad('k_ih1app in component kinetic_parameters (first_order_rate_constant)'); LEGEND_CONSTANTS(:,54) = strpad('k_ih1bpp in component kinetic_parameters (first_order_rate_constant)'); LEGEND_CONSTANTS(:,55) = strpad('k_ih1epp in component kinetic_parameters (first_order_rate_constant)'); LEGEND_CONSTANTS(:,56) = strpad('k_ih1dpp in component kinetic_parameters (first_order_rate_constant)'); LEGEND_CONSTANTS(:,57) = strpad('k_sip in component kinetic_parameters (first_order_rate_constant)'); LEGEND_CONSTANTS(:,58) = strpad('k_sipp in component kinetic_parameters (first_order_rate_constant)'); LEGEND_CONSTANTS(:,59) = strpad('k_dip in component kinetic_parameters (first_order_rate_constant)'); LEGEND_CONSTANTS(:,60) = strpad('k_diapp in component kinetic_parameters (first_order_rate_constant)'); LEGEND_CONSTANTS(:,61) = strpad('k_diepp in component kinetic_parameters (first_order_rate_constant)'); LEGEND_CONSTANTS(:,62) = strpad('k_didpp in component kinetic_parameters (first_order_rate_constant)'); LEGEND_CONSTANTS(:,63) = strpad('k_dibpp in component kinetic_parameters (first_order_rate_constant)'); LEGEND_CONSTANTS(:,64) = strpad('k_14di in component kinetic_parameters (dimensionless)'); LEGEND_ALGEBRAIC(:,3) = strpad('preMPF in component preMPF (dimensionless)'); LEGEND_ALGEBRAIC(:,4) = strpad('CycBT in component CycBT (dimensionless)'); LEGEND_ALGEBRAIC(:,5) = strpad('CycAT in component CycAT (dimensionless)'); LEGEND_ALGEBRAIC(:,6) = strpad('CycET in component CycET (dimensionless)'); LEGEND_ALGEBRAIC(:,7) = strpad('Tri_B in component Tri_B (dimensionless)'); LEGEND_ALGEBRAIC(:,8) = strpad('CKIT in component CKIT (dimensionless)'); LEGEND_ALGEBRAIC(:,9) = strpad('Cdc20_T in component Cdc20_T (dimensionless)'); LEGEND_ALGEBRAIC(:,23) = strpad('TF_B in component TF_B (dimensionless)'); LEGEND_CONSTANTS(:,65) = strpad('k_afb in component kinetic_parameters (first_order_rate_constant)'); LEGEND_CONSTANTS(:,66) = strpad('k_ifb in component kinetic_parameters (first_order_rate_constant)'); LEGEND_CONSTANTS(:,67) = strpad('J_ifb in component TF_B (dimensionless)'); LEGEND_CONSTANTS(:,68) = strpad('J_afb in component TF_B (dimensionless)'); LEGEND_CONSTANTS(:,69) = strpad('k_sbp in component kinetic_parameters (first_order_rate_constant)'); LEGEND_CONSTANTS(:,70) = strpad('k_sbpp in component kinetic_parameters (first_order_rate_constant)'); LEGEND_CONSTANTS(:,71) = strpad('k_sap in component kinetic_parameters (first_order_rate_constant)'); LEGEND_CONSTANTS(:,72) = strpad('k_sapp in component kinetic_parameters (first_order_rate_constant)'); LEGEND_CONSTANTS(:,73) = strpad('k_sep in component kinetic_parameters (first_order_rate_constant)'); LEGEND_CONSTANTS(:,74) = strpad('k_sepp in component kinetic_parameters (first_order_rate_constant)'); LEGEND_CONSTANTS(:,75) = strpad('k_dbp in component kinetic_parameters (first_order_rate_constant)'); LEGEND_CONSTANTS(:,76) = strpad('k_dbhpp in component kinetic_parameters (first_order_rate_constant)'); LEGEND_CONSTANTS(:,77) = strpad('k_dbcpp in component kinetic_parameters (first_order_rate_constant)'); LEGEND_ALGEBRAIC(:,27) = strpad('Wee1 in component Wee1 (dimensionless)'); LEGEND_CONSTANTS(:,78) = strpad('k_aweep in component kinetic_parameters (first_order_rate_constant)'); LEGEND_CONSTANTS(:,79) = strpad('k_aweepp in component kinetic_parameters (first_order_rate_constant)'); LEGEND_CONSTANTS(:,80) = strpad('k_iweep in component kinetic_parameters (first_order_rate_constant)'); LEGEND_CONSTANTS(:,81) = strpad('k_iweepp in component kinetic_parameters (first_order_rate_constant)'); LEGEND_CONSTANTS(:,82) = strpad('J_iwee in component Wee1 (dimensionless)'); LEGEND_CONSTANTS(:,83) = strpad('J_awee in component Wee1 (dimensionless)'); LEGEND_CONSTANTS(:,84) = strpad('k_weep in component kinetic_parameters (first_order_rate_constant)'); LEGEND_CONSTANTS(:,85) = strpad('k_weepp in component kinetic_parameters (first_order_rate_constant)'); LEGEND_ALGEBRAIC(:,29) = strpad('Cdc25 in component Cdc25 (dimensionless)'); LEGEND_CONSTANTS(:,86) = strpad('k_a25p in component kinetic_parameters (first_order_rate_constant)'); LEGEND_CONSTANTS(:,87) = strpad('k_a25pp in component kinetic_parameters (first_order_rate_constant)'); LEGEND_CONSTANTS(:,88) = strpad('k_i25p in component kinetic_parameters (first_order_rate_constant)'); LEGEND_CONSTANTS(:,89) = strpad('k_i25pp in component kinetic_parameters (first_order_rate_constant)'); LEGEND_CONSTANTS(:,90) = strpad('J_i25 in component Cdc25 (dimensionless)'); LEGEND_CONSTANTS(:,91) = strpad('J_a25 in component Cdc25 (dimensionless)'); LEGEND_CONSTANTS(:,92) = strpad('k_25p in component kinetic_parameters (first_order_rate_constant)'); LEGEND_CONSTANTS(:,93) = strpad('k_25pp in component kinetic_parameters (first_order_rate_constant)'); LEGEND_RATES(:,1) = strpad('d/dt CycA in component CycA (dimensionless)'); LEGEND_RATES(:,4) = strpad('d/dt CycB in component CycB (dimensionless)'); LEGEND_RATES(:,7) = strpad('d/dt CycE in component CycE (dimensionless)'); LEGEND_RATES(:,10) = strpad('d/dt Cdc20_A in component Cdc20_A (dimensionless)'); LEGEND_RATES(:,12) = strpad('d/dt Cdc20_i in component Cdc20_i (dimensionless)'); LEGEND_RATES(:,11) = strpad('d/dt APCP in component APCP (dimensionless)'); LEGEND_RATES(:,5) = strpad('d/dt pB in component pB (dimensionless)'); LEGEND_RATES(:,6) = strpad('d/dt BCKI in component BCKI (dimensionless)'); LEGEND_RATES(:,13) = strpad('d/dt pBCKI in component pBCKI (dimensionless)'); LEGEND_RATES(:,2) = strpad('d/dt Tri_A in component Tri_A (dimensionless)'); LEGEND_RATES(:,8) = strpad('d/dt Tri_E in component Tri_E (dimensionless)'); LEGEND_RATES(:,3) = strpad('d/dt CKI in component CKI (dimensionless)'); LEGEND_RATES(:,14) = strpad('d/dt Cdh1 in component Cdh1 (dimensionless)'); LEGEND_RATES(:,9) = strpad('d/dt mass in component mass (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) = 0.09450308233499527; CONSTANTS(:,1) = 50; CONSTANTS(:,2) = 0.06; STATES(:,2) = 0.3492224216461182; STATES(:,3) = 0.02882070094347; STATES(:,4) = 0.1903585940599442; CONSTANTS(:,3) = 60; CONSTANTS(:,4) = 0.05; STATES(:,5) = 0.01234426256269217; STATES(:,6) = 0.679449200630188; STATES(:,7) = 0.2092024385929108; CONSTANTS(:,5) = 0; CONSTANTS(:,6) = 0; STATES(:,8) = 0; CONSTANTS(:,7) = 0.108; STATES(:,9) = 1.338267803192139; STATES(:,10) = 0.3572723865509033; CONSTANTS(:,8) = 1; CONSTANTS(:,9) = 0.16; CONSTANTS(:,10) = 0.05; STATES(:,11) = 0.07591402530670166; STATES(:,12) = 0.7702387571334839; CONSTANTS(:,11) = 1; CONSTANTS(:,12) = 1; CONSTANTS(:,13) = 0.001; CONSTANTS(:,14) = 1; CONSTANTS(:,15) = 1; CONSTANTS(:,16) = 10; CONSTANTS(:,17) = 1; CONSTANTS(:,18) = 1; CONSTANTS(:,19) = 1; CONSTANTS(:,20) = 0.1; CONSTANTS(:,21) = 0.15; CONSTANTS(:,22) = 0.1; CONSTANTS(:,23) = 0.1; STATES(:,13) = 0.04795938357710838; CONSTANTS(:,24) = 1; STATES(:,14) = 0.7189393639564514; CONSTANTS(:,25) = 0.03; CONSTANTS(:,26) = 0.03; CONSTANTS(:,27) = 0.005776; CONSTANTS(:,28) = 10000; CONSTANTS(:,29) = 0; CONSTANTS(:,30) = 1.5; CONSTANTS(:,31) = 0.38; CONSTANTS(:,32) = 3; CONSTANTS(:,33) = 0.75; CONSTANTS(:,34) = 0; CONSTANTS(:,35) = 8; CONSTANTS(:,36) = 0.01; CONSTANTS(:,37) = 0.01; CONSTANTS(:,38) = 0.12; CONSTANTS(:,39) = 0; CONSTANTS(:,40) = 0; CONSTANTS(:,41) = 0; CONSTANTS(:,42) = 0.01; CONSTANTS(:,43) = 0.16; CONSTANTS(:,44) = 0; CONSTANTS(:,45) = 6; CONSTANTS(:,46) = 0.008; CONSTANTS(:,47) = 0.05; CONSTANTS(:,48) = 2; CONSTANTS(:,49) = 1; CONSTANTS(:,50) = 0.02; CONSTANTS(:,51) = 0.8; CONSTANTS(:,52) = 0.001; CONSTANTS(:,53) = 0.35; CONSTANTS(:,54) = 0.1; CONSTANTS(:,55) = 0.06; CONSTANTS(:,56) = 0.005; CONSTANTS(:,57) = 0.018; CONSTANTS(:,58) = 0.18; CONSTANTS(:,59) = 0.02; CONSTANTS(:,60) = 0.1; CONSTANTS(:,61) = 0.12; CONSTANTS(:,62) = 0.1; CONSTANTS(:,63) = 0.8; CONSTANTS(:,64) = 12; CONSTANTS(:,65) = 1; CONSTANTS(:,66) = 0.15; CONSTANTS(:,67) = 0.1; CONSTANTS(:,68) = 0.1; CONSTANTS(:,69) = 0.004; CONSTANTS(:,70) = 0.04; CONSTANTS(:,71) = 0.0015; CONSTANTS(:,72) = 0.01; CONSTANTS(:,73) = 0; CONSTANTS(:,74) = 0.15; CONSTANTS(:,75) = 0.003; CONSTANTS(:,76) = 0.4; CONSTANTS(:,77) = 0.15; CONSTANTS(:,78) = 0.3; CONSTANTS(:,79) = 0; CONSTANTS(:,80) = 0; CONSTANTS(:,81) = 1; CONSTANTS(:,82) = 0.05; CONSTANTS(:,83) = 0.05; CONSTANTS(:,84) = 0.02; CONSTANTS(:,85) = 0.2; CONSTANTS(:,86) = 0; CONSTANTS(:,87) = 1; CONSTANTS(:,88) = 0.3; CONSTANTS(:,89) = 0; CONSTANTS(:,90) = 0.1; CONSTANTS(:,91) = 0.1; CONSTANTS(:,92) = 0.01; CONSTANTS(:,93) = 5; 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(:,10) = (( CONSTANTS(:,8).*STATES(:,11).*STATES(:,12))./(CONSTANTS(:,11)+STATES(:,12)) - ( STATES(:,10).*CONSTANTS(:,9))./(CONSTANTS(:,12)+STATES(:,10))) - STATES(:,10).*CONSTANTS(:,10); RATES(:,12) = (((CONSTANTS(:,13)+ CONSTANTS(:,14).*power(STATES(:,4), CONSTANTS(:,15)))./(power(CONSTANTS(:,16), CONSTANTS(:,15))+power(STATES(:,4), CONSTANTS(:,15)))+( STATES(:,10).*CONSTANTS(:,9))./(CONSTANTS(:,18)+STATES(:,10))) - CONSTANTS(:,10).*STATES(:,12)) - ( CONSTANTS(:,8).*STATES(:,11).*STATES(:,12))./(CONSTANTS(:,17)+STATES(:,12)); RATES(:,9) = CONSTANTS(:,27).*STATES(:,9).*(1.00000 - STATES(:,9)./CONSTANTS(:,28)); ALGEBRAIC(:,1) = (CONSTANTS(:,19) - STATES(:,11))./1.00000; RATES(:,11) = ( CONSTANTS(:,20).*STATES(:,4).*ALGEBRAIC(:,1))./(CONSTANTS(:,22)+ALGEBRAIC(:,1)) - ( CONSTANTS(:,21).*STATES(:,11))./(CONSTANTS(:,23)+STATES(:,11)); ALGEBRAIC(:,10) = (CONSTANTS(:,24) - STATES(:,14))./1.00000; ALGEBRAIC(:,16) = STATES(:,10); ALGEBRAIC(:,18) = CONSTANTS(:,50)+ CONSTANTS(:,51).*ALGEBRAIC(:,16); ALGEBRAIC(:,2) = CONSTANTS(:,7).*STATES(:,9); ALGEBRAIC(:,20) = CONSTANTS(:,52)+ CONSTANTS(:,53).*STATES(:,1)+ CONSTANTS(:,54).*STATES(:,4)+ CONSTANTS(:,55).*STATES(:,7)+ CONSTANTS(:,56).*ALGEBRAIC(:,2); RATES(:,14) = ( ALGEBRAIC(:,10).*ALGEBRAIC(:,18))./(CONSTANTS(:,25)+ALGEBRAIC(:,10)) - ( STATES(:,14).*ALGEBRAIC(:,20))./(CONSTANTS(:,26)+STATES(:,14)); ALGEBRAIC(:,21) = (CONSTANTS(:,59)+ CONSTANTS(:,60).*STATES(:,1)+ CONSTANTS(:,63).*STATES(:,4)+ CONSTANTS(:,61).*STATES(:,7)+ CONSTANTS(:,62).*ALGEBRAIC(:,2))./(1.00000+ CONSTANTS(:,64).*ALGEBRAIC(:,16)); ALGEBRAIC(:,15) = CONSTANTS(:,42)+ (CONSTANTS(:,43)+CONSTANTS(:,44)).*STATES(:,10)+ CONSTANTS(:,44).*STATES(:,12); RATES(:,2) = (( CONSTANTS(:,1).*STATES(:,3).*STATES(:,1) - CONSTANTS(:,2).*STATES(:,2)) - ALGEBRAIC(:,21).*STATES(:,2)) - ALGEBRAIC(:,15).*STATES(:,2); ALGEBRAIC(:,14) = CONSTANTS(:,38)+ CONSTANTS(:,39).*STATES(:,7)+ CONSTANTS(:,40).*STATES(:,1)+ CONSTANTS(:,41).*STATES(:,4); RATES(:,8) = (( CONSTANTS(:,6).*STATES(:,3).*STATES(:,7) - CONSTANTS(:,5).*STATES(:,8)) - ALGEBRAIC(:,21).*STATES(:,8)) - ALGEBRAIC(:,14).*STATES(:,8); ALGEBRAIC(:,11) = CONSTANTS(:,29)+ CONSTANTS(:,30).*STATES(:,1)+ CONSTANTS(:,31).*STATES(:,7)+ CONSTANTS(:,32).*ALGEBRAIC(:,2); ALGEBRAIC(:,12) = CONSTANTS(:,33)+ CONSTANTS(:,34).*STATES(:,1)+ CONSTANTS(:,35).*STATES(:,4); ALGEBRAIC(:,13) = ( 2.00000.*ALGEBRAIC(:,11).*CONSTANTS(:,36))./((ALGEBRAIC(:,12) - ALGEBRAIC(:,11))+ CONSTANTS(:,37).*ALGEBRAIC(:,12)+ CONSTANTS(:,36).*ALGEBRAIC(:,11)+power((power((ALGEBRAIC(:,12) - ALGEBRAIC(:,11))+ CONSTANTS(:,37).*ALGEBRAIC(:,12)+ CONSTANTS(:,36).*ALGEBRAIC(:,11), 2.00000) - 4.00000.*(ALGEBRAIC(:,12) - ALGEBRAIC(:,11)).*CONSTANTS(:,36).*ALGEBRAIC(:,11)), 1.0 ./ 2)); ALGEBRAIC(:,22) = STATES(:,9).*(CONSTANTS(:,71)+ CONSTANTS(:,72).*ALGEBRAIC(:,13)); RATES(:,1) = (( CONSTANTS(:,2).*STATES(:,2)+ ALGEBRAIC(:,21).*STATES(:,2)+ALGEBRAIC(:,22)) - ALGEBRAIC(:,15).*STATES(:,1)) - CONSTANTS(:,1).*STATES(:,3).*STATES(:,1); ALGEBRAIC(:,24) = STATES(:,9).*(CONSTANTS(:,73)+ CONSTANTS(:,74).*ALGEBRAIC(:,13)); RATES(:,7) = (( CONSTANTS(:,5).*STATES(:,8)+ ALGEBRAIC(:,21).*STATES(:,8)+ALGEBRAIC(:,24)) - ALGEBRAIC(:,14).*STATES(:,7)) - CONSTANTS(:,6).*STATES(:,3).*STATES(:,7); ALGEBRAIC(:,26) = CONSTANTS(:,75)+ CONSTANTS(:,76).*STATES(:,14)+ CONSTANTS(:,77).*STATES(:,10); ALGEBRAIC(:,17) = ( 2.00000.*CONSTANTS(:,45).*ALGEBRAIC(:,16).*CONSTANTS(:,48))./(((CONSTANTS(:,46)+ CONSTANTS(:,47).*STATES(:,4)) - CONSTANTS(:,45).*ALGEBRAIC(:,16))+ CONSTANTS(:,49).*(CONSTANTS(:,46)+ CONSTANTS(:,47).*STATES(:,4))+ CONSTANTS(:,48).*CONSTANTS(:,45).*ALGEBRAIC(:,16)+power((power(((CONSTANTS(:,46)+ CONSTANTS(:,47).*STATES(:,4)) - CONSTANTS(:,45).*ALGEBRAIC(:,16))+ CONSTANTS(:,49).*(CONSTANTS(:,46)+ CONSTANTS(:,47).*STATES(:,4))+ CONSTANTS(:,48).*CONSTANTS(:,45).*ALGEBRAIC(:,16), 2.00000) - 4.00000.*((CONSTANTS(:,46)+ CONSTANTS(:,47).*STATES(:,4)) - CONSTANTS(:,45).*ALGEBRAIC(:,16)).*CONSTANTS(:,48).*CONSTANTS(:,45).*ALGEBRAIC(:,16)), 1.0 ./ 2)); ALGEBRAIC(:,19) = CONSTANTS(:,57)+ CONSTANTS(:,58).*ALGEBRAIC(:,17); RATES(:,3) = ((((((( - CONSTANTS(:,3).*STATES(:,4).*STATES(:,3)+ CONSTANTS(:,4).*STATES(:,6)) - CONSTANTS(:,3).*STATES(:,5).*STATES(:,3))+ CONSTANTS(:,4).*STATES(:,13)+ ALGEBRAIC(:,26).*STATES(:,6)+ ALGEBRAIC(:,26).*STATES(:,13)+ALGEBRAIC(:,19)) - ALGEBRAIC(:,21).*STATES(:,3)) - CONSTANTS(:,1).*STATES(:,3).*STATES(:,1))+ CONSTANTS(:,2).*STATES(:,2)+ ALGEBRAIC(:,15).*STATES(:,2)) - CONSTANTS(:,6).*STATES(:,3).*STATES(:,7))+ CONSTANTS(:,5).*STATES(:,8)+ ALGEBRAIC(:,14).*STATES(:,8); ALGEBRAIC(:,23) = ( 2.00000.*CONSTANTS(:,65).*STATES(:,4).*CONSTANTS(:,67))./((CONSTANTS(:,66) - CONSTANTS(:,65).*STATES(:,4))+ CONSTANTS(:,68).*CONSTANTS(:,66)+ CONSTANTS(:,67).*CONSTANTS(:,65).*STATES(:,4)+power((power((CONSTANTS(:,66) - CONSTANTS(:,65).*STATES(:,4))+ CONSTANTS(:,68).*CONSTANTS(:,66)+ CONSTANTS(:,67).*CONSTANTS(:,65).*STATES(:,4), 2.00000) - 4.00000.*(CONSTANTS(:,66) - CONSTANTS(:,65).*STATES(:,4)).*CONSTANTS(:,65).*STATES(:,4).*CONSTANTS(:,67)), 1.0 ./ 2)); ALGEBRAIC(:,25) = STATES(:,9).*(CONSTANTS(:,69)+ CONSTANTS(:,70).*ALGEBRAIC(:,23)); ALGEBRAIC(:,29) = ( 2.00000.*(CONSTANTS(:,86)+ CONSTANTS(:,87).*STATES(:,4)).*CONSTANTS(:,90))./(((CONSTANTS(:,88)+ CONSTANTS(:,89).*ALGEBRAIC(:,16)) - (CONSTANTS(:,86)+ CONSTANTS(:,87).*STATES(:,4)))+ CONSTANTS(:,91).*(CONSTANTS(:,88)+ CONSTANTS(:,89).*ALGEBRAIC(:,16))+ (CONSTANTS(:,86)+ CONSTANTS(:,87).*STATES(:,4)).*CONSTANTS(:,90)+power((power(((CONSTANTS(:,88)+ CONSTANTS(:,89).*ALGEBRAIC(:,16)) - (CONSTANTS(:,86)+ CONSTANTS(:,87).*STATES(:,4)))+ CONSTANTS(:,91).*(CONSTANTS(:,88)+ CONSTANTS(:,89).*ALGEBRAIC(:,16))+ (CONSTANTS(:,86)+ CONSTANTS(:,87).*STATES(:,4)).*CONSTANTS(:,90), 2.00000) - 4.00000.*((CONSTANTS(:,88)+ CONSTANTS(:,89).*ALGEBRAIC(:,16)) - (CONSTANTS(:,86)+ CONSTANTS(:,87).*STATES(:,4))).*(CONSTANTS(:,86)+ CONSTANTS(:,87).*STATES(:,4)).*CONSTANTS(:,90)), 1.0 ./ 2)); ALGEBRAIC(:,30) = CONSTANTS(:,92)+ CONSTANTS(:,93).*ALGEBRAIC(:,29); ALGEBRAIC(:,27) = ( 2.00000.*(CONSTANTS(:,78)+ CONSTANTS(:,79).*ALGEBRAIC(:,16)).*CONSTANTS(:,82))./(((CONSTANTS(:,80)+ CONSTANTS(:,81).*STATES(:,4)) - (CONSTANTS(:,78)+ CONSTANTS(:,79).*ALGEBRAIC(:,16)))+ CONSTANTS(:,83).*(CONSTANTS(:,80)+ CONSTANTS(:,81).*STATES(:,4))+ CONSTANTS(:,82).*(CONSTANTS(:,78)+ CONSTANTS(:,79).*ALGEBRAIC(:,16))+power((power(((CONSTANTS(:,80)+ CONSTANTS(:,81).*STATES(:,4)) - (CONSTANTS(:,78)+ CONSTANTS(:,79).*ALGEBRAIC(:,16)))+ CONSTANTS(:,83).*(CONSTANTS(:,80)+ CONSTANTS(:,81).*STATES(:,4))+ CONSTANTS(:,82).*(CONSTANTS(:,78)+ CONSTANTS(:,79).*ALGEBRAIC(:,16)), 2.00000) - 4.00000.*((CONSTANTS(:,80)+ CONSTANTS(:,81).*STATES(:,4)) - (CONSTANTS(:,78)+ CONSTANTS(:,79).*ALGEBRAIC(:,16))).*(CONSTANTS(:,78)+ CONSTANTS(:,79).*ALGEBRAIC(:,16)).*CONSTANTS(:,82)), 1.0 ./ 2)); ALGEBRAIC(:,28) = CONSTANTS(:,84)+ CONSTANTS(:,85).*ALGEBRAIC(:,27); RATES(:,4) = ((((ALGEBRAIC(:,25) - ALGEBRAIC(:,26).*STATES(:,4))+ ALGEBRAIC(:,30).*STATES(:,5)) - ALGEBRAIC(:,28).*STATES(:,4)) - CONSTANTS(:,3).*STATES(:,4).*STATES(:,3))+ CONSTANTS(:,4).*STATES(:,6)+ ALGEBRAIC(:,21).*STATES(:,6); RATES(:,5) = ((( ALGEBRAIC(:,28).*STATES(:,4) - ALGEBRAIC(:,26).*STATES(:,5)) - CONSTANTS(:,3).*STATES(:,5).*STATES(:,3))+ CONSTANTS(:,4).*STATES(:,13)+ ALGEBRAIC(:,21).*STATES(:,13)) - ALGEBRAIC(:,30).*STATES(:,5); RATES(:,6) = (((( CONSTANTS(:,3).*STATES(:,4).*STATES(:,3) - CONSTANTS(:,4).*STATES(:,6))+ ALGEBRAIC(:,30).*STATES(:,13)) - ALGEBRAIC(:,28).*STATES(:,6)) - ALGEBRAIC(:,26).*STATES(:,6)) - ALGEBRAIC(:,21).*STATES(:,6); RATES(:,13) = (((( CONSTANTS(:,3).*STATES(:,5).*STATES(:,3) - CONSTANTS(:,4).*STATES(:,13)) - ALGEBRAIC(:,30).*STATES(:,13))+ ALGEBRAIC(:,28).*STATES(:,6)) - ALGEBRAIC(:,26).*STATES(:,13)) - ALGEBRAIC(:,21).*STATES(:,13); RATES = RATES'; end % Calculate algebraic variables function ALGEBRAIC = computeAlgebraic(ALGEBRAIC, CONSTANTS, STATES, VOI) statesSize = size(STATES); statesColumnCount = statesSize(2); if ( statesColumnCount == 1) STATES = STATES'; utilOnes = 1; else statesRowCount = statesSize(1); utilOnes = ones(statesRowCount, 1); end ALGEBRAIC(:,1) = (CONSTANTS(:,19) - STATES(:,11))./1.00000; ALGEBRAIC(:,10) = (CONSTANTS(:,24) - STATES(:,14))./1.00000; ALGEBRAIC(:,16) = STATES(:,10); ALGEBRAIC(:,18) = CONSTANTS(:,50)+ CONSTANTS(:,51).*ALGEBRAIC(:,16); ALGEBRAIC(:,2) = CONSTANTS(:,7).*STATES(:,9); ALGEBRAIC(:,20) = CONSTANTS(:,52)+ CONSTANTS(:,53).*STATES(:,1)+ CONSTANTS(:,54).*STATES(:,4)+ CONSTANTS(:,55).*STATES(:,7)+ CONSTANTS(:,56).*ALGEBRAIC(:,2); ALGEBRAIC(:,21) = (CONSTANTS(:,59)+ CONSTANTS(:,60).*STATES(:,1)+ CONSTANTS(:,63).*STATES(:,4)+ CONSTANTS(:,61).*STATES(:,7)+ CONSTANTS(:,62).*ALGEBRAIC(:,2))./(1.00000+ CONSTANTS(:,64).*ALGEBRAIC(:,16)); ALGEBRAIC(:,15) = CONSTANTS(:,42)+ (CONSTANTS(:,43)+CONSTANTS(:,44)).*STATES(:,10)+ CONSTANTS(:,44).*STATES(:,12); ALGEBRAIC(:,14) = CONSTANTS(:,38)+ CONSTANTS(:,39).*STATES(:,7)+ CONSTANTS(:,40).*STATES(:,1)+ CONSTANTS(:,41).*STATES(:,4); ALGEBRAIC(:,11) = CONSTANTS(:,29)+ CONSTANTS(:,30).*STATES(:,1)+ CONSTANTS(:,31).*STATES(:,7)+ CONSTANTS(:,32).*ALGEBRAIC(:,2); ALGEBRAIC(:,12) = CONSTANTS(:,33)+ CONSTANTS(:,34).*STATES(:,1)+ CONSTANTS(:,35).*STATES(:,4); ALGEBRAIC(:,13) = ( 2.00000.*ALGEBRAIC(:,11).*CONSTANTS(:,36))./((ALGEBRAIC(:,12) - ALGEBRAIC(:,11))+ CONSTANTS(:,37).*ALGEBRAIC(:,12)+ CONSTANTS(:,36).*ALGEBRAIC(:,11)+power((power((ALGEBRAIC(:,12) - ALGEBRAIC(:,11))+ CONSTANTS(:,37).*ALGEBRAIC(:,12)+ CONSTANTS(:,36).*ALGEBRAIC(:,11), 2.00000) - 4.00000.*(ALGEBRAIC(:,12) - ALGEBRAIC(:,11)).*CONSTANTS(:,36).*ALGEBRAIC(:,11)), 1.0 ./ 2)); ALGEBRAIC(:,22) = STATES(:,9).*(CONSTANTS(:,71)+ CONSTANTS(:,72).*ALGEBRAIC(:,13)); ALGEBRAIC(:,24) = STATES(:,9).*(CONSTANTS(:,73)+ CONSTANTS(:,74).*ALGEBRAIC(:,13)); ALGEBRAIC(:,26) = CONSTANTS(:,75)+ CONSTANTS(:,76).*STATES(:,14)+ CONSTANTS(:,77).*STATES(:,10); ALGEBRAIC(:,17) = ( 2.00000.*CONSTANTS(:,45).*ALGEBRAIC(:,16).*CONSTANTS(:,48))./(((CONSTANTS(:,46)+ CONSTANTS(:,47).*STATES(:,4)) - CONSTANTS(:,45).*ALGEBRAIC(:,16))+ CONSTANTS(:,49).*(CONSTANTS(:,46)+ CONSTANTS(:,47).*STATES(:,4))+ CONSTANTS(:,48).*CONSTANTS(:,45).*ALGEBRAIC(:,16)+power((power(((CONSTANTS(:,46)+ CONSTANTS(:,47).*STATES(:,4)) - CONSTANTS(:,45).*ALGEBRAIC(:,16))+ CONSTANTS(:,49).*(CONSTANTS(:,46)+ CONSTANTS(:,47).*STATES(:,4))+ CONSTANTS(:,48).*CONSTANTS(:,45).*ALGEBRAIC(:,16), 2.00000) - 4.00000.*((CONSTANTS(:,46)+ CONSTANTS(:,47).*STATES(:,4)) - CONSTANTS(:,45).*ALGEBRAIC(:,16)).*CONSTANTS(:,48).*CONSTANTS(:,45).*ALGEBRAIC(:,16)), 1.0 ./ 2)); ALGEBRAIC(:,19) = CONSTANTS(:,57)+ CONSTANTS(:,58).*ALGEBRAIC(:,17); ALGEBRAIC(:,23) = ( 2.00000.*CONSTANTS(:,65).*STATES(:,4).*CONSTANTS(:,67))./((CONSTANTS(:,66) - CONSTANTS(:,65).*STATES(:,4))+ CONSTANTS(:,68).*CONSTANTS(:,66)+ CONSTANTS(:,67).*CONSTANTS(:,65).*STATES(:,4)+power((power((CONSTANTS(:,66) - CONSTANTS(:,65).*STATES(:,4))+ CONSTANTS(:,68).*CONSTANTS(:,66)+ CONSTANTS(:,67).*CONSTANTS(:,65).*STATES(:,4), 2.00000) - 4.00000.*(CONSTANTS(:,66) - CONSTANTS(:,65).*STATES(:,4)).*CONSTANTS(:,65).*STATES(:,4).*CONSTANTS(:,67)), 1.0 ./ 2)); ALGEBRAIC(:,25) = STATES(:,9).*(CONSTANTS(:,69)+ CONSTANTS(:,70).*ALGEBRAIC(:,23)); ALGEBRAIC(:,29) = ( 2.00000.*(CONSTANTS(:,86)+ CONSTANTS(:,87).*STATES(:,4)).*CONSTANTS(:,90))./(((CONSTANTS(:,88)+ CONSTANTS(:,89).*ALGEBRAIC(:,16)) - (CONSTANTS(:,86)+ CONSTANTS(:,87).*STATES(:,4)))+ CONSTANTS(:,91).*(CONSTANTS(:,88)+ CONSTANTS(:,89).*ALGEBRAIC(:,16))+ (CONSTANTS(:,86)+ CONSTANTS(:,87).*STATES(:,4)).*CONSTANTS(:,90)+power((power(((CONSTANTS(:,88)+ CONSTANTS(:,89).*ALGEBRAIC(:,16)) - (CONSTANTS(:,86)+ CONSTANTS(:,87).*STATES(:,4)))+ CONSTANTS(:,91).*(CONSTANTS(:,88)+ CONSTANTS(:,89).*ALGEBRAIC(:,16))+ (CONSTANTS(:,86)+ CONSTANTS(:,87).*STATES(:,4)).*CONSTANTS(:,90), 2.00000) - 4.00000.*((CONSTANTS(:,88)+ CONSTANTS(:,89).*ALGEBRAIC(:,16)) - (CONSTANTS(:,86)+ CONSTANTS(:,87).*STATES(:,4))).*(CONSTANTS(:,86)+ CONSTANTS(:,87).*STATES(:,4)).*CONSTANTS(:,90)), 1.0 ./ 2)); ALGEBRAIC(:,30) = CONSTANTS(:,92)+ CONSTANTS(:,93).*ALGEBRAIC(:,29); ALGEBRAIC(:,27) = ( 2.00000.*(CONSTANTS(:,78)+ CONSTANTS(:,79).*ALGEBRAIC(:,16)).*CONSTANTS(:,82))./(((CONSTANTS(:,80)+ CONSTANTS(:,81).*STATES(:,4)) - (CONSTANTS(:,78)+ CONSTANTS(:,79).*ALGEBRAIC(:,16)))+ CONSTANTS(:,83).*(CONSTANTS(:,80)+ CONSTANTS(:,81).*STATES(:,4))+ CONSTANTS(:,82).*(CONSTANTS(:,78)+ CONSTANTS(:,79).*ALGEBRAIC(:,16))+power((power(((CONSTANTS(:,80)+ CONSTANTS(:,81).*STATES(:,4)) - (CONSTANTS(:,78)+ CONSTANTS(:,79).*ALGEBRAIC(:,16)))+ CONSTANTS(:,83).*(CONSTANTS(:,80)+ CONSTANTS(:,81).*STATES(:,4))+ CONSTANTS(:,82).*(CONSTANTS(:,78)+ CONSTANTS(:,79).*ALGEBRAIC(:,16)), 2.00000) - 4.00000.*((CONSTANTS(:,80)+ CONSTANTS(:,81).*STATES(:,4)) - (CONSTANTS(:,78)+ CONSTANTS(:,79).*ALGEBRAIC(:,16))).*(CONSTANTS(:,78)+ CONSTANTS(:,79).*ALGEBRAIC(:,16)).*CONSTANTS(:,82)), 1.0 ./ 2)); ALGEBRAIC(:,28) = CONSTANTS(:,84)+ CONSTANTS(:,85).*ALGEBRAIC(:,27); ALGEBRAIC(:,3) = STATES(:,5)+STATES(:,6); ALGEBRAIC(:,4) = STATES(:,4)+STATES(:,5)+STATES(:,6)+STATES(:,13); ALGEBRAIC(:,5) = STATES(:,1)+STATES(:,2); ALGEBRAIC(:,6) = STATES(:,7)+STATES(:,8); ALGEBRAIC(:,7) = STATES(:,6)+STATES(:,13); ALGEBRAIC(:,8) = STATES(:,3)+STATES(:,6)+STATES(:,13)+STATES(:,2)+STATES(:,8); ALGEBRAIC(:,9) = STATES(:,12)+STATES(:,10); 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