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 =43;
end
% There are a total of 7 entries in each of the rate and state variable arrays.
% There are a total of 41 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 (second)');
    LEGEND_CONSTANTS(:,1) = strpad('k0_12 in component parameters (per_M2_per_second)');
    LEGEND_CONSTANTS(:,2) = strpad('k0_21 in component parameters (per_second)');
    LEGEND_CONSTANTS(:,3) = strpad('k0_23 in component parameters (per_M_per_second)');
    LEGEND_CONSTANTS(:,4) = strpad('k0_32 in component parameters (per_second)');
    LEGEND_CONSTANTS(:,5) = strpad('k0_34 in component parameters (per_second)');
    LEGEND_CONSTANTS(:,6) = strpad('k0_43 in component parameters (per_second)');
    LEGEND_CONSTANTS(:,7) = strpad('k0_45 in component parameters (per_second)');
    LEGEND_CONSTANTS(:,8) = strpad('k0_54 in component parameters (per_M_per_second)');
    LEGEND_CONSTANTS(:,9) = strpad('k0_25 in component parameters (per_second)');
    LEGEND_CONSTANTS(:,10) = strpad('k0_52 in component parameters (per_second)');
    LEGEND_CONSTANTS(:,11) = strpad('k0_56 in component parameters (per_second)');
    LEGEND_CONSTANTS(:,12) = strpad('k0_65_f in component parameters (per_M2_per_second)');
    LEGEND_CONSTANTS(:,13) = strpad('k0_61_f in component parameters (per_second)');
    LEGEND_CONSTANTS(:,14) = strpad('k0_16_f in component parameters (per_second)');
    LEGEND_CONSTANTS(:,15) = strpad('k0_65_r in component parameters (per_M2_per_second)');
    LEGEND_CONSTANTS(:,16) = strpad('k0_61_r in component parameters (per_second)');
    LEGEND_CONSTANTS(:,17) = strpad('k0_16_r in component parameters (per_second)');
    LEGEND_CONSTANTS(:,33) = strpad('k0_65 in component parameters (per_M2_per_second)');
    LEGEND_CONSTANTS(:,34) = strpad('k0_61 in component parameters (per_second)');
    LEGEND_CONSTANTS(:,35) = strpad('k0_16 in component parameters (per_second)');
    LEGEND_CONSTANTS(:,18) = strpad('delta in component parameters (dimensionless)');
    LEGEND_CONSTANTS(:,36) = strpad('alpha_p in component parameters (dimensionless)');
    LEGEND_CONSTANTS(:,19) = strpad('alpha_pp in component parameters (dimensionless)');
    LEGEND_CONSTANTS(:,20) = strpad('N_C in component parameters (dimensionless)');
    LEGEND_CONSTANTS(:,21) = strpad('N_Avo in component parameters (per_mol)');
    LEGEND_CONSTANTS(:,22) = strpad('area in component parameters (um2)');
    LEGEND_CONSTANTS(:,37) = strpad('C_T in component parameters (umol)');
    LEGEND_CONSTANTS(:,23) = strpad('n in component parameters (dimensionless)');
    LEGEND_CONSTANTS(:,24) = strpad('z_c in component parameters (dimensionless)');
    LEGEND_CONSTANTS(:,25) = strpad('z_Na in component parameters (dimensionless)');
    LEGEND_CONSTANTS(:,26) = strpad('F in component parameters (C_per_mol)');
    LEGEND_CONSTANTS(:,27) = strpad('R in component parameters (J_per_K_per_mol)');
    LEGEND_CONSTANTS(:,28) = strpad('T in component parameters (kelvin)');
    LEGEND_STATES(:,1) = strpad('V in component ion_concentrations (volt)');
    LEGEND_ALGEBRAIC(:,1) = strpad('mu in component parameters (dimensionless)');
    LEGEND_CONSTANTS(:,29) = strpad('Na_o in component ion_concentrations (M)');
    LEGEND_CONSTANTS(:,30) = strpad('Na_i in component ion_concentrations (M)');
    LEGEND_CONSTANTS(:,31) = strpad('glucose_i in component ion_concentrations (M)');
    LEGEND_CONSTANTS(:,32) = strpad('glucose_o in component ion_concentrations (M)');
    LEGEND_ALGEBRAIC(:,4) = strpad('k_12 in component rate_constants (per_second)');
    LEGEND_ALGEBRAIC(:,5) = strpad('k_21 in component rate_constants (per_second)');
    LEGEND_CONSTANTS(:,38) = strpad('k_23 in component rate_constants (per_second)');
    LEGEND_CONSTANTS(:,39) = strpad('k_32 in component rate_constants (per_second)');
    LEGEND_ALGEBRAIC(:,6) = strpad('k_34 in component rate_constants (per_second)');
    LEGEND_ALGEBRAIC(:,7) = strpad('k_43 in component rate_constants (per_second)');
    LEGEND_CONSTANTS(:,40) = strpad('k_45 in component rate_constants (per_second)');
    LEGEND_ALGEBRAIC(:,15) = strpad('k_54 in component rate_constants (per_second)');
    LEGEND_ALGEBRAIC(:,8) = strpad('k_25 in component rate_constants (per_second)');
    LEGEND_ALGEBRAIC(:,13) = strpad('k_52 in component rate_constants (per_second)');
    LEGEND_ALGEBRAIC(:,9) = strpad('k_56 in component rate_constants (per_second)');
    LEGEND_ALGEBRAIC(:,10) = strpad('k_65 in component rate_constants (per_second)');
    LEGEND_ALGEBRAIC(:,11) = strpad('k_61 in component rate_constants (per_second)');
    LEGEND_ALGEBRAIC(:,12) = strpad('k_16 in component rate_constants (per_second)');
    LEGEND_ALGEBRAIC(:,2) = strpad('ks_12 in component rate_constants (per_M2_per_second)');
    LEGEND_ALGEBRAIC(:,14) = strpad('k0_54_temp in component rate_constants (per_M_per_second)');
    LEGEND_ALGEBRAIC(:,3) = strpad('k_52_temp in component rate_constants (per_second)');
    LEGEND_STATES(:,2) = strpad('C_1 in component kinetic_equations (umol)');
    LEGEND_STATES(:,3) = strpad('C_2 in component kinetic_equations (umol)');
    LEGEND_STATES(:,4) = strpad('C_3 in component kinetic_equations (umol)');
    LEGEND_STATES(:,5) = strpad('C_4 in component kinetic_equations (umol)');
    LEGEND_STATES(:,6) = strpad('C_5 in component kinetic_equations (umol)');
    LEGEND_ALGEBRAIC(:,16) = strpad('C_6 in component kinetic_equations (umol)');
    LEGEND_STATES(:,7) = strpad('C_6_temp in component kinetic_equations (umol)');
    LEGEND_ALGEBRAIC(:,17) = strpad('C1_sum in component king_altman_states (per_second5)');
    LEGEND_ALGEBRAIC(:,19) = strpad('C2_sum in component king_altman_states (per_second5)');
    LEGEND_ALGEBRAIC(:,23) = strpad('C3_sum in component king_altman_states (per_second5)');
    LEGEND_ALGEBRAIC(:,25) = strpad('C4_sum in component king_altman_states (per_second5)');
    LEGEND_ALGEBRAIC(:,28) = strpad('C5_sum in component king_altman_states (per_second5)');
    LEGEND_ALGEBRAIC(:,32) = strpad('C6_sum in component king_altman_states (per_second5)');
    LEGEND_ALGEBRAIC(:,36) = strpad('C_sum in component king_altman_states (per_second5)');
    LEGEND_ALGEBRAIC(:,37) = strpad('C1 in component king_altman_states (umol)');
    LEGEND_ALGEBRAIC(:,38) = strpad('C2 in component king_altman_states (umol)');
    LEGEND_ALGEBRAIC(:,39) = strpad('C3 in component king_altman_states (umol)');
    LEGEND_ALGEBRAIC(:,40) = strpad('C4 in component king_altman_states (umol)');
    LEGEND_ALGEBRAIC(:,41) = strpad('C5 in component king_altman_states (umol)');
    LEGEND_ALGEBRAIC(:,42) = strpad('C6 in component king_altman_states (umol)');
    LEGEND_ALGEBRAIC(:,20) = strpad('I_NaGl_pSS in component NBC_current (uA)');
    LEGEND_ALGEBRAIC(:,43) = strpad('I_NaGl_SS in component NBC_current (uA)');
    LEGEND_ALGEBRAIC(:,29) = strpad('epsilon in component phenomonological_constants (per_second)');
    LEGEND_ALGEBRAIC(:,18) = strpad('lambda in component phenomonological_constants (per_M3_per_second5)');
    LEGEND_ALGEBRAIC(:,21) = strpad('chi in component phenomonological_constants (M)');
    LEGEND_ALGEBRAIC(:,27) = strpad('alpha in component phenomonological_constants (M3)');
    LEGEND_ALGEBRAIC(:,24) = strpad('beta in component phenomonological_constants (M2)');
    LEGEND_ALGEBRAIC(:,22) = strpad('gamma in component phenomonological_constants (M3_per_second)');
    LEGEND_ALGEBRAIC(:,26) = strpad('phi in component phenomonological_constants (M_per_second)');
    LEGEND_ALGEBRAIC(:,33) = strpad('Imax_Na in component phenomonological_constants (uA)');
    LEGEND_ALGEBRAIC(:,34) = strpad('Imax_gluc in component phenomonological_constants (uA)');
    LEGEND_ALGEBRAIC(:,30) = strpad('Khalf_Na_sq in component phenomonological_constants (M2)');
    LEGEND_ALGEBRAIC(:,35) = strpad('Khalf_Na in component phenomonological_constants (M)');
    LEGEND_ALGEBRAIC(:,31) = strpad('Khalf_gluc in component phenomonological_constants (M)');
    LEGEND_RATES(:,1) = strpad('d/dt V in component ion_concentrations (volt)');
    LEGEND_RATES(:,2) = strpad('d/dt C_1 in component kinetic_equations (umol)');
    LEGEND_RATES(:,3) = strpad('d/dt C_2 in component kinetic_equations (umol)');
    LEGEND_RATES(:,4) = strpad('d/dt C_3 in component kinetic_equations (umol)');
    LEGEND_RATES(:,5) = strpad('d/dt C_4 in component kinetic_equations (umol)');
    LEGEND_RATES(:,6) = strpad('d/dt C_5 in component kinetic_equations (umol)');
    LEGEND_RATES(:,7) = strpad('d/dt C_6_temp in component kinetic_equations (umol)');
    LEGEND_STATES  = LEGEND_STATES';
    LEGEND_ALGEBRAIC = LEGEND_ALGEBRAIC';
    LEGEND_RATES = LEGEND_RATES';
    LEGEND_CONSTANTS = LEGEND_CONSTANTS';
end

function [STATES, CONSTANTS] = initConsts()
    VOI = 0; CONSTANTS = []; STATES = []; ALGEBRAIC = [];
    CONSTANTS(:,1) = 80000;
    CONSTANTS(:,2) = 500;
    CONSTANTS(:,3) = 1e5;
    CONSTANTS(:,4) = 20;
    CONSTANTS(:,5) = 50;
    CONSTANTS(:,6) = 50;
    CONSTANTS(:,7) = 800;
    CONSTANTS(:,8) = 1.219e4;
    CONSTANTS(:,9) = 0.3;
    CONSTANTS(:,10) = 9.1e-4;
    CONSTANTS(:,11) = 10;
    CONSTANTS(:,12) = 50;
    CONSTANTS(:,13) = 5;
    CONSTANTS(:,14) = 35;
    CONSTANTS(:,15) = 4500;
    CONSTANTS(:,16) = 3;
    CONSTANTS(:,17) = 350;
    CONSTANTS(:,18) = 0.7;
    CONSTANTS(:,19) = 0;
    CONSTANTS(:,20) = 3e6;
    CONSTANTS(:,21) = 6.022e23;
    CONSTANTS(:,22) = 1e6;
    CONSTANTS(:,23) = 2;
    CONSTANTS(:,24) = -2;
    CONSTANTS(:,25) = 1;
    CONSTANTS(:,26) = 96485.34;
    CONSTANTS(:,27) = 8.314;
    CONSTANTS(:,28) = 310;
    STATES(:,1) = -150e-3;
    CONSTANTS(:,29) = 10e-3;
    CONSTANTS(:,30) = 500e-3;
    CONSTANTS(:,31) = 100e-3;
    CONSTANTS(:,32) = 0e-3;
    STATES(:,2) = 0;
    STATES(:,3) = 0;
    STATES(:,4) = 0;
    STATES(:,5) = 0;
    STATES(:,6) = 0;
    STATES(:,7) = 0;
    CONSTANTS(:,33) = piecewise({CONSTANTS(:,29)<0.100000, CONSTANTS(:,15) }, CONSTANTS(:,12));
    CONSTANTS(:,40) = 0.200000;
    CONSTANTS(:,34) = piecewise({CONSTANTS(:,29)<0.100000, CONSTANTS(:,16) }, CONSTANTS(:,13));
    CONSTANTS(:,35) = piecewise({CONSTANTS(:,29)<0.100000, CONSTANTS(:,17) }, CONSTANTS(:,14));
    CONSTANTS(:,36) = (1.00000 - CONSTANTS(:,18)) - CONSTANTS(:,19);
    CONSTANTS(:,37) = ( 1.00000e+06.*CONSTANTS(:,20))./CONSTANTS(:,21);
    CONSTANTS(:,38) =  CONSTANTS(:,3).*CONSTANTS(:,32);
    CONSTANTS(:,39) = CONSTANTS(:,4);
    CONSTANTS(:,40) = CONSTANTS(:,7);
    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(:,1) = CONSTANTS(:,40);
    ALGEBRAIC(:,1) = ( CONSTANTS(:,26).*STATES(:,1))./( CONSTANTS(:,27).*CONSTANTS(:,28));
    ALGEBRAIC(:,6) =  CONSTANTS(:,5).*exp((  - (CONSTANTS(:,24)+CONSTANTS(:,23)).*CONSTANTS(:,18).*ALGEBRAIC(:,1))./2.00000);
    ALGEBRAIC(:,7) =  CONSTANTS(:,6).*exp(( (CONSTANTS(:,24)+CONSTANTS(:,23)).*CONSTANTS(:,18).*ALGEBRAIC(:,1))./2.00000);
    RATES(:,4) = ( CONSTANTS(:,38).*STATES(:,3)+ ALGEBRAIC(:,7).*STATES(:,5)) -  (CONSTANTS(:,39)+ALGEBRAIC(:,6)).*STATES(:,4);
    ALGEBRAIC(:,9) =  CONSTANTS(:,11).*exp((  - CONSTANTS(:,23).*CONSTANTS(:,25).*CONSTANTS(:,19).*ALGEBRAIC(:,1))./2.00000);
    ALGEBRAIC(:,10) =  CONSTANTS(:,33).*power(CONSTANTS(:,30), CONSTANTS(:,23)).*exp(( CONSTANTS(:,23).*CONSTANTS(:,25).*CONSTANTS(:,19).*ALGEBRAIC(:,1))./2.00000);
    ALGEBRAIC(:,11) =  CONSTANTS(:,34).*exp(( CONSTANTS(:,24).*CONSTANTS(:,18).*ALGEBRAIC(:,1))./2.00000);
    ALGEBRAIC(:,12) =  CONSTANTS(:,35).*exp((  - CONSTANTS(:,24).*CONSTANTS(:,18).*ALGEBRAIC(:,1))./2.00000);
    RATES(:,7) = ( ALGEBRAIC(:,12).*STATES(:,2)+ ALGEBRAIC(:,9).*STATES(:,6)) -  (ALGEBRAIC(:,11)+ALGEBRAIC(:,10)).*STATES(:,7);
    ALGEBRAIC(:,2) =  CONSTANTS(:,1).*exp((  - CONSTANTS(:,23).*CONSTANTS(:,36).*ALGEBRAIC(:,1))./2.00000);
    ALGEBRAIC(:,4) =  ALGEBRAIC(:,2).*power(CONSTANTS(:,29), CONSTANTS(:,23));
    ALGEBRAIC(:,5) =  CONSTANTS(:,2).*exp(( CONSTANTS(:,23).*CONSTANTS(:,25).*CONSTANTS(:,36).*ALGEBRAIC(:,1))./2.00000);
    ALGEBRAIC(:,8) =  CONSTANTS(:,9).*exp((  - (CONSTANTS(:,24)+CONSTANTS(:,23)).*CONSTANTS(:,18).*ALGEBRAIC(:,1))./2.00000);
    ALGEBRAIC(:,13) = ( CONSTANTS(:,1).*ALGEBRAIC(:,8).*CONSTANTS(:,11).*CONSTANTS(:,34))./( CONSTANTS(:,2).*CONSTANTS(:,35).*CONSTANTS(:,33));
    RATES(:,3) = ( ALGEBRAIC(:,4).*STATES(:,2)+ CONSTANTS(:,39).*STATES(:,4)+ ALGEBRAIC(:,13).*STATES(:,6)) -  (ALGEBRAIC(:,5)+CONSTANTS(:,38)+ALGEBRAIC(:,8)).*STATES(:,3);
    ALGEBRAIC(:,14) = ( CONSTANTS(:,3).*ALGEBRAIC(:,6).*CONSTANTS(:,40).*ALGEBRAIC(:,13))./( ALGEBRAIC(:,7).*CONSTANTS(:,39).*ALGEBRAIC(:,8));
    ALGEBRAIC(:,15) =  ALGEBRAIC(:,14).*CONSTANTS(:,31);
    RATES(:,5) = ( ALGEBRAIC(:,6).*STATES(:,4)+ ALGEBRAIC(:,15).*STATES(:,6)) -  (CONSTANTS(:,40)+ALGEBRAIC(:,7)).*STATES(:,5);
    ALGEBRAIC(:,16) = CONSTANTS(:,37) - (STATES(:,2)+STATES(:,3)+STATES(:,4)+STATES(:,5)+STATES(:,6));
    RATES(:,2) = ( ALGEBRAIC(:,5).*STATES(:,3)+ ALGEBRAIC(:,11).*ALGEBRAIC(:,16)) -  (ALGEBRAIC(:,4)+ALGEBRAIC(:,12)).*STATES(:,2);
    RATES(:,6) = ( CONSTANTS(:,40).*STATES(:,5)+ ALGEBRAIC(:,10).*ALGEBRAIC(:,16)+ ALGEBRAIC(:,8).*STATES(:,3)) -  (ALGEBRAIC(:,15)+ALGEBRAIC(:,13)+ALGEBRAIC(:,9)).*STATES(:,6);
   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(:,26).*STATES(:,1))./( CONSTANTS(:,27).*CONSTANTS(:,28));
    ALGEBRAIC(:,6) =  CONSTANTS(:,5).*exp((  - (CONSTANTS(:,24)+CONSTANTS(:,23)).*CONSTANTS(:,18).*ALGEBRAIC(:,1))./2.00000);
    ALGEBRAIC(:,7) =  CONSTANTS(:,6).*exp(( (CONSTANTS(:,24)+CONSTANTS(:,23)).*CONSTANTS(:,18).*ALGEBRAIC(:,1))./2.00000);
    ALGEBRAIC(:,9) =  CONSTANTS(:,11).*exp((  - CONSTANTS(:,23).*CONSTANTS(:,25).*CONSTANTS(:,19).*ALGEBRAIC(:,1))./2.00000);
    ALGEBRAIC(:,10) =  CONSTANTS(:,33).*power(CONSTANTS(:,30), CONSTANTS(:,23)).*exp(( CONSTANTS(:,23).*CONSTANTS(:,25).*CONSTANTS(:,19).*ALGEBRAIC(:,1))./2.00000);
    ALGEBRAIC(:,11) =  CONSTANTS(:,34).*exp(( CONSTANTS(:,24).*CONSTANTS(:,18).*ALGEBRAIC(:,1))./2.00000);
    ALGEBRAIC(:,12) =  CONSTANTS(:,35).*exp((  - CONSTANTS(:,24).*CONSTANTS(:,18).*ALGEBRAIC(:,1))./2.00000);
    ALGEBRAIC(:,2) =  CONSTANTS(:,1).*exp((  - CONSTANTS(:,23).*CONSTANTS(:,36).*ALGEBRAIC(:,1))./2.00000);
    ALGEBRAIC(:,4) =  ALGEBRAIC(:,2).*power(CONSTANTS(:,29), CONSTANTS(:,23));
    ALGEBRAIC(:,5) =  CONSTANTS(:,2).*exp(( CONSTANTS(:,23).*CONSTANTS(:,25).*CONSTANTS(:,36).*ALGEBRAIC(:,1))./2.00000);
    ALGEBRAIC(:,8) =  CONSTANTS(:,9).*exp((  - (CONSTANTS(:,24)+CONSTANTS(:,23)).*CONSTANTS(:,18).*ALGEBRAIC(:,1))./2.00000);
    ALGEBRAIC(:,13) = ( CONSTANTS(:,1).*ALGEBRAIC(:,8).*CONSTANTS(:,11).*CONSTANTS(:,34))./( CONSTANTS(:,2).*CONSTANTS(:,35).*CONSTANTS(:,33));
    ALGEBRAIC(:,14) = ( CONSTANTS(:,3).*ALGEBRAIC(:,6).*CONSTANTS(:,40).*ALGEBRAIC(:,13))./( ALGEBRAIC(:,7).*CONSTANTS(:,39).*ALGEBRAIC(:,8));
    ALGEBRAIC(:,15) =  ALGEBRAIC(:,14).*CONSTANTS(:,31);
    ALGEBRAIC(:,16) = CONSTANTS(:,37) - (STATES(:,2)+STATES(:,3)+STATES(:,4)+STATES(:,5)+STATES(:,6));
    ALGEBRAIC(:,3) =  CONSTANTS(:,10).*exp(( (CONSTANTS(:,24)+CONSTANTS(:,23)).*CONSTANTS(:,18).*ALGEBRAIC(:,1))./2.00000);
    ALGEBRAIC(:,17) =  ALGEBRAIC(:,5).*CONSTANTS(:,39).*ALGEBRAIC(:,7).*ALGEBRAIC(:,15).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,5).*ALGEBRAIC(:,6).*CONSTANTS(:,40).*ALGEBRAIC(:,13).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,5).*CONSTANTS(:,39).*CONSTANTS(:,40).*ALGEBRAIC(:,13).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,5).*CONSTANTS(:,39).*ALGEBRAIC(:,7).*ALGEBRAIC(:,13).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,8).*ALGEBRAIC(:,6).*CONSTANTS(:,40).*ALGEBRAIC(:,9).*ALGEBRAIC(:,11)+ CONSTANTS(:,38).*ALGEBRAIC(:,6).*CONSTANTS(:,40).*ALGEBRAIC(:,9).*ALGEBRAIC(:,11)+ ALGEBRAIC(:,5).*ALGEBRAIC(:,6).*CONSTANTS(:,40).*ALGEBRAIC(:,9).*ALGEBRAIC(:,11)+ ALGEBRAIC(:,8).*CONSTANTS(:,39).*CONSTANTS(:,40).*ALGEBRAIC(:,9).*ALGEBRAIC(:,11)+ ALGEBRAIC(:,5).*CONSTANTS(:,39).*CONSTANTS(:,40).*ALGEBRAIC(:,9).*ALGEBRAIC(:,11)+ ALGEBRAIC(:,8).*CONSTANTS(:,39).*ALGEBRAIC(:,7).*ALGEBRAIC(:,9).*ALGEBRAIC(:,11)+ ALGEBRAIC(:,5).*CONSTANTS(:,39).*ALGEBRAIC(:,7).*ALGEBRAIC(:,9).*ALGEBRAIC(:,11)+ ALGEBRAIC(:,5).*CONSTANTS(:,39).*ALGEBRAIC(:,7).*ALGEBRAIC(:,15).*ALGEBRAIC(:,11)+ ALGEBRAIC(:,5).*ALGEBRAIC(:,6).*CONSTANTS(:,40).*ALGEBRAIC(:,13).*ALGEBRAIC(:,11)+ ALGEBRAIC(:,5).*CONSTANTS(:,39).*CONSTANTS(:,40).*ALGEBRAIC(:,13).*ALGEBRAIC(:,11)+ ALGEBRAIC(:,5).*CONSTANTS(:,39).*ALGEBRAIC(:,7).*ALGEBRAIC(:,13).*ALGEBRAIC(:,11);
    ALGEBRAIC(:,18) =  ALGEBRAIC(:,2).*CONSTANTS(:,3).*ALGEBRAIC(:,7).*ALGEBRAIC(:,15).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,2).*CONSTANTS(:,3).*ALGEBRAIC(:,6).*ALGEBRAIC(:,15).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,2).*CONSTANTS(:,3).*CONSTANTS(:,40).*ALGEBRAIC(:,13).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,2).*CONSTANTS(:,3).*ALGEBRAIC(:,7).*ALGEBRAIC(:,13).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,2).*CONSTANTS(:,3).*ALGEBRAIC(:,6).*ALGEBRAIC(:,13).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,2).*CONSTANTS(:,3).*ALGEBRAIC(:,6).*CONSTANTS(:,40).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,2).*CONSTANTS(:,3).*CONSTANTS(:,40).*ALGEBRAIC(:,9).*ALGEBRAIC(:,11)+ ALGEBRAIC(:,2).*CONSTANTS(:,3).*ALGEBRAIC(:,7).*ALGEBRAIC(:,9).*ALGEBRAIC(:,11)+ ALGEBRAIC(:,2).*CONSTANTS(:,3).*ALGEBRAIC(:,6).*ALGEBRAIC(:,9).*ALGEBRAIC(:,11)+ ALGEBRAIC(:,2).*CONSTANTS(:,3).*ALGEBRAIC(:,7).*ALGEBRAIC(:,15).*ALGEBRAIC(:,11)+ ALGEBRAIC(:,2).*CONSTANTS(:,3).*ALGEBRAIC(:,6).*ALGEBRAIC(:,15).*ALGEBRAIC(:,11)+ ALGEBRAIC(:,2).*CONSTANTS(:,3).*CONSTANTS(:,40).*ALGEBRAIC(:,13).*ALGEBRAIC(:,11)+ ALGEBRAIC(:,2).*CONSTANTS(:,3).*ALGEBRAIC(:,7).*ALGEBRAIC(:,13).*ALGEBRAIC(:,11)+ ALGEBRAIC(:,2).*CONSTANTS(:,3).*ALGEBRAIC(:,6).*ALGEBRAIC(:,13).*ALGEBRAIC(:,11)+ ALGEBRAIC(:,2).*CONSTANTS(:,3).*ALGEBRAIC(:,6).*CONSTANTS(:,40).*ALGEBRAIC(:,11)+ ALGEBRAIC(:,2).*CONSTANTS(:,3).*ALGEBRAIC(:,6).*CONSTANTS(:,40).*ALGEBRAIC(:,9);
    ALGEBRAIC(:,19) =  ALGEBRAIC(:,12).*CONSTANTS(:,39).*ALGEBRAIC(:,7).*ALGEBRAIC(:,15).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,4).*CONSTANTS(:,39).*ALGEBRAIC(:,7).*ALGEBRAIC(:,15).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,12).*ALGEBRAIC(:,6).*CONSTANTS(:,40).*ALGEBRAIC(:,13).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,4).*ALGEBRAIC(:,6).*CONSTANTS(:,40).*ALGEBRAIC(:,13).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,12).*CONSTANTS(:,39).*CONSTANTS(:,40).*ALGEBRAIC(:,13).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,4).*CONSTANTS(:,39).*CONSTANTS(:,40).*ALGEBRAIC(:,13).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,12).*CONSTANTS(:,39).*ALGEBRAIC(:,7).*ALGEBRAIC(:,13).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,4).*CONSTANTS(:,39).*ALGEBRAIC(:,7).*ALGEBRAIC(:,13).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,4).*ALGEBRAIC(:,6).*CONSTANTS(:,40).*ALGEBRAIC(:,9).*ALGEBRAIC(:,11)+ ALGEBRAIC(:,4).*CONSTANTS(:,39).*CONSTANTS(:,40).*ALGEBRAIC(:,9).*ALGEBRAIC(:,11)+ ALGEBRAIC(:,4).*CONSTANTS(:,39).*ALGEBRAIC(:,7).*ALGEBRAIC(:,9).*ALGEBRAIC(:,11)+ ALGEBRAIC(:,4).*CONSTANTS(:,39).*ALGEBRAIC(:,7).*ALGEBRAIC(:,15).*ALGEBRAIC(:,11)+ ALGEBRAIC(:,4).*ALGEBRAIC(:,6).*CONSTANTS(:,40).*ALGEBRAIC(:,13).*ALGEBRAIC(:,11)+ ALGEBRAIC(:,4).*CONSTANTS(:,39).*CONSTANTS(:,40).*ALGEBRAIC(:,13).*ALGEBRAIC(:,11)+ ALGEBRAIC(:,4).*CONSTANTS(:,39).*ALGEBRAIC(:,7).*ALGEBRAIC(:,13).*ALGEBRAIC(:,11);
    ALGEBRAIC(:,20) =   - CONSTANTS(:,26).*( CONSTANTS(:,23).*CONSTANTS(:,25).*CONSTANTS(:,36).*( ALGEBRAIC(:,4).*STATES(:,2) -  ALGEBRAIC(:,5).*STATES(:,3))+ CONSTANTS(:,24).*CONSTANTS(:,18).*( ALGEBRAIC(:,12).*STATES(:,2) -  ALGEBRAIC(:,11).*ALGEBRAIC(:,16))+ CONSTANTS(:,23).*CONSTANTS(:,25).*CONSTANTS(:,19).*( ALGEBRAIC(:,9).*STATES(:,6) -  ALGEBRAIC(:,10).*ALGEBRAIC(:,16)));
    ALGEBRAIC(:,21) =  (1.00000./ALGEBRAIC(:,18)).*( ALGEBRAIC(:,2).*CONSTANTS(:,39).*ALGEBRAIC(:,7).*ALGEBRAIC(:,15).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,2).*ALGEBRAIC(:,8).*ALGEBRAIC(:,7).*ALGEBRAIC(:,15).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,2).*ALGEBRAIC(:,8).*ALGEBRAIC(:,6).*ALGEBRAIC(:,15).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,2).*ALGEBRAIC(:,8).*CONSTANTS(:,39).*ALGEBRAIC(:,15).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,2).*ALGEBRAIC(:,6).*CONSTANTS(:,40).*ALGEBRAIC(:,13).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,2).*CONSTANTS(:,39).*CONSTANTS(:,40).*ALGEBRAIC(:,13).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,2).*CONSTANTS(:,39).*ALGEBRAIC(:,7).*ALGEBRAIC(:,13).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,2).*ALGEBRAIC(:,8).*ALGEBRAIC(:,6).*CONSTANTS(:,40).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,2).*ALGEBRAIC(:,8).*CONSTANTS(:,39).*CONSTANTS(:,40).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,2).*ALGEBRAIC(:,8).*CONSTANTS(:,39).*ALGEBRAIC(:,7).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,2).*ALGEBRAIC(:,6).*CONSTANTS(:,40).*ALGEBRAIC(:,9).*ALGEBRAIC(:,11)+ ALGEBRAIC(:,2).*CONSTANTS(:,39).*CONSTANTS(:,40).*ALGEBRAIC(:,9).*ALGEBRAIC(:,11)+ ALGEBRAIC(:,2).*CONSTANTS(:,39).*ALGEBRAIC(:,7).*ALGEBRAIC(:,9).*ALGEBRAIC(:,11)+ ALGEBRAIC(:,2).*CONSTANTS(:,39).*ALGEBRAIC(:,7).*ALGEBRAIC(:,15).*ALGEBRAIC(:,11)+ ALGEBRAIC(:,2).*ALGEBRAIC(:,8).*ALGEBRAIC(:,7).*ALGEBRAIC(:,15).*ALGEBRAIC(:,11)+ ALGEBRAIC(:,2).*ALGEBRAIC(:,8).*ALGEBRAIC(:,6).*ALGEBRAIC(:,15).*ALGEBRAIC(:,11)+ ALGEBRAIC(:,2).*ALGEBRAIC(:,8).*CONSTANTS(:,39).*ALGEBRAIC(:,15).*ALGEBRAIC(:,11)+ ALGEBRAIC(:,2).*ALGEBRAIC(:,6).*CONSTANTS(:,40).*ALGEBRAIC(:,13).*ALGEBRAIC(:,11)+ ALGEBRAIC(:,2).*CONSTANTS(:,39).*CONSTANTS(:,40).*ALGEBRAIC(:,13).*ALGEBRAIC(:,11)+ ALGEBRAIC(:,2).*CONSTANTS(:,39).*ALGEBRAIC(:,7).*ALGEBRAIC(:,13).*ALGEBRAIC(:,11)+ ALGEBRAIC(:,2).*ALGEBRAIC(:,8).*ALGEBRAIC(:,6).*CONSTANTS(:,40).*ALGEBRAIC(:,11)+ ALGEBRAIC(:,2).*ALGEBRAIC(:,8).*CONSTANTS(:,39).*CONSTANTS(:,40).*ALGEBRAIC(:,11)+ ALGEBRAIC(:,2).*ALGEBRAIC(:,8).*CONSTANTS(:,39).*ALGEBRAIC(:,7).*ALGEBRAIC(:,11)+ ALGEBRAIC(:,2).*ALGEBRAIC(:,8).*ALGEBRAIC(:,6).*CONSTANTS(:,40).*ALGEBRAIC(:,9)+ ALGEBRAIC(:,2).*ALGEBRAIC(:,8).*CONSTANTS(:,39).*CONSTANTS(:,40).*ALGEBRAIC(:,9)+ ALGEBRAIC(:,2).*ALGEBRAIC(:,8).*CONSTANTS(:,39).*ALGEBRAIC(:,7).*ALGEBRAIC(:,9));
    ALGEBRAIC(:,22) =  (1.00000./ALGEBRAIC(:,18)).*( ALGEBRAIC(:,12).*ALGEBRAIC(:,5).*CONSTANTS(:,39).*ALGEBRAIC(:,7).*ALGEBRAIC(:,15).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,12).*ALGEBRAIC(:,5).*ALGEBRAIC(:,6).*CONSTANTS(:,40).*ALGEBRAIC(:,13).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,12).*ALGEBRAIC(:,5).*CONSTANTS(:,39).*CONSTANTS(:,40).*ALGEBRAIC(:,13).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,12).*ALGEBRAIC(:,5).*CONSTANTS(:,39).*ALGEBRAIC(:,7).*ALGEBRAIC(:,13).*ALGEBRAIC(:,10));
    ALGEBRAIC(:,23) =  ALGEBRAIC(:,12).*ALGEBRAIC(:,8).*ALGEBRAIC(:,7).*ALGEBRAIC(:,15).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,4).*ALGEBRAIC(:,8).*ALGEBRAIC(:,7).*ALGEBRAIC(:,15).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,12).*CONSTANTS(:,38).*ALGEBRAIC(:,7).*ALGEBRAIC(:,15).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,4).*CONSTANTS(:,38).*ALGEBRAIC(:,7).*ALGEBRAIC(:,15).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,12).*ALGEBRAIC(:,5).*ALGEBRAIC(:,7).*ALGEBRAIC(:,15).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,12).*CONSTANTS(:,38).*CONSTANTS(:,40).*ALGEBRAIC(:,13).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,4).*CONSTANTS(:,38).*CONSTANTS(:,40).*ALGEBRAIC(:,13).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,12).*CONSTANTS(:,38).*ALGEBRAIC(:,7).*ALGEBRAIC(:,13).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,4).*CONSTANTS(:,38).*ALGEBRAIC(:,7).*ALGEBRAIC(:,13).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,4).*CONSTANTS(:,38).*CONSTANTS(:,40).*ALGEBRAIC(:,9).*ALGEBRAIC(:,11)+ ALGEBRAIC(:,4).*CONSTANTS(:,38).*ALGEBRAIC(:,7).*ALGEBRAIC(:,9).*ALGEBRAIC(:,11)+ ALGEBRAIC(:,4).*ALGEBRAIC(:,8).*ALGEBRAIC(:,7).*ALGEBRAIC(:,15).*ALGEBRAIC(:,11)+ ALGEBRAIC(:,4).*CONSTANTS(:,38).*ALGEBRAIC(:,7).*ALGEBRAIC(:,15).*ALGEBRAIC(:,11)+ ALGEBRAIC(:,4).*CONSTANTS(:,38).*CONSTANTS(:,40).*ALGEBRAIC(:,13).*ALGEBRAIC(:,11)+ ALGEBRAIC(:,4).*CONSTANTS(:,38).*ALGEBRAIC(:,7).*ALGEBRAIC(:,13).*ALGEBRAIC(:,11);
    ALGEBRAIC(:,24) =  (1.00000./ALGEBRAIC(:,18)).*( CONSTANTS(:,3).*ALGEBRAIC(:,12).*ALGEBRAIC(:,7).*ALGEBRAIC(:,15).*ALGEBRAIC(:,10)+ CONSTANTS(:,3).*ALGEBRAIC(:,12).*ALGEBRAIC(:,6).*ALGEBRAIC(:,15).*ALGEBRAIC(:,10)+ CONSTANTS(:,3).*ALGEBRAIC(:,12).*CONSTANTS(:,40).*ALGEBRAIC(:,13).*ALGEBRAIC(:,10)+ CONSTANTS(:,3).*ALGEBRAIC(:,12).*ALGEBRAIC(:,7).*ALGEBRAIC(:,13).*ALGEBRAIC(:,10)+ CONSTANTS(:,3).*ALGEBRAIC(:,12).*ALGEBRAIC(:,6).*ALGEBRAIC(:,13).*ALGEBRAIC(:,10)+ CONSTANTS(:,3).*ALGEBRAIC(:,12).*ALGEBRAIC(:,6).*CONSTANTS(:,40).*ALGEBRAIC(:,10)+ CONSTANTS(:,3).*ALGEBRAIC(:,6).*CONSTANTS(:,40).*ALGEBRAIC(:,9).*ALGEBRAIC(:,11)+ CONSTANTS(:,3).*ALGEBRAIC(:,12).*ALGEBRAIC(:,6).*CONSTANTS(:,40).*ALGEBRAIC(:,9));
    ALGEBRAIC(:,25) =  ALGEBRAIC(:,12).*ALGEBRAIC(:,8).*ALGEBRAIC(:,6).*ALGEBRAIC(:,15).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,4).*ALGEBRAIC(:,8).*ALGEBRAIC(:,6).*ALGEBRAIC(:,15).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,12).*CONSTANTS(:,38).*ALGEBRAIC(:,6).*ALGEBRAIC(:,15).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,4).*CONSTANTS(:,38).*ALGEBRAIC(:,6).*ALGEBRAIC(:,15).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,12).*ALGEBRAIC(:,5).*ALGEBRAIC(:,6).*ALGEBRAIC(:,15).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,12).*ALGEBRAIC(:,8).*CONSTANTS(:,39).*ALGEBRAIC(:,15).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,4).*ALGEBRAIC(:,8).*CONSTANTS(:,39).*ALGEBRAIC(:,15).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,12).*ALGEBRAIC(:,5).*CONSTANTS(:,39).*ALGEBRAIC(:,15).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,12).*CONSTANTS(:,38).*ALGEBRAIC(:,6).*ALGEBRAIC(:,13).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,4).*CONSTANTS(:,38).*ALGEBRAIC(:,6).*ALGEBRAIC(:,13).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,4).*CONSTANTS(:,38).*ALGEBRAIC(:,6).*ALGEBRAIC(:,9).*ALGEBRAIC(:,11)+ ALGEBRAIC(:,4).*ALGEBRAIC(:,8).*ALGEBRAIC(:,6).*ALGEBRAIC(:,15).*ALGEBRAIC(:,11)+ ALGEBRAIC(:,4).*CONSTANTS(:,38).*ALGEBRAIC(:,6).*ALGEBRAIC(:,15).*ALGEBRAIC(:,11)+ ALGEBRAIC(:,4).*ALGEBRAIC(:,8).*CONSTANTS(:,39).*ALGEBRAIC(:,15).*ALGEBRAIC(:,11)+ ALGEBRAIC(:,4).*CONSTANTS(:,38).*ALGEBRAIC(:,6).*ALGEBRAIC(:,13).*ALGEBRAIC(:,11);
    ALGEBRAIC(:,26) =  (1.00000./ALGEBRAIC(:,18)).*((  - ALGEBRAIC(:,2).*ALGEBRAIC(:,8).*ALGEBRAIC(:,6).*CONSTANTS(:,40).*ALGEBRAIC(:,9).*ALGEBRAIC(:,11) -  ALGEBRAIC(:,2).*ALGEBRAIC(:,8).*CONSTANTS(:,39).*CONSTANTS(:,40).*ALGEBRAIC(:,9).*ALGEBRAIC(:,11)) -  ALGEBRAIC(:,2).*ALGEBRAIC(:,8).*CONSTANTS(:,39).*ALGEBRAIC(:,7).*ALGEBRAIC(:,9).*ALGEBRAIC(:,11));
    ALGEBRAIC(:,27) =  (1.00000./ALGEBRAIC(:,18)).*( ALGEBRAIC(:,5).*CONSTANTS(:,39).*ALGEBRAIC(:,7).*ALGEBRAIC(:,15).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,12).*CONSTANTS(:,39).*ALGEBRAIC(:,7).*ALGEBRAIC(:,15).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,12).*ALGEBRAIC(:,8).*ALGEBRAIC(:,7).*ALGEBRAIC(:,15).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,12).*ALGEBRAIC(:,5).*ALGEBRAIC(:,7).*ALGEBRAIC(:,15).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,12).*ALGEBRAIC(:,8).*ALGEBRAIC(:,6).*ALGEBRAIC(:,15).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,12).*ALGEBRAIC(:,5).*ALGEBRAIC(:,6).*ALGEBRAIC(:,15).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,12).*ALGEBRAIC(:,8).*CONSTANTS(:,39).*ALGEBRAIC(:,15).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,12).*ALGEBRAIC(:,5).*CONSTANTS(:,39).*ALGEBRAIC(:,15).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,5).*ALGEBRAIC(:,6).*CONSTANTS(:,40).*ALGEBRAIC(:,13).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,12).*ALGEBRAIC(:,6).*CONSTANTS(:,40).*ALGEBRAIC(:,13).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,5).*CONSTANTS(:,39).*CONSTANTS(:,40).*ALGEBRAIC(:,13).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,12).*CONSTANTS(:,39).*CONSTANTS(:,40).*ALGEBRAIC(:,13).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,5).*CONSTANTS(:,39).*ALGEBRAIC(:,7).*ALGEBRAIC(:,13).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,12).*CONSTANTS(:,39).*ALGEBRAIC(:,7).*ALGEBRAIC(:,13).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,12).*ALGEBRAIC(:,8).*ALGEBRAIC(:,6).*CONSTANTS(:,40).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,12).*ALGEBRAIC(:,5).*ALGEBRAIC(:,6).*CONSTANTS(:,40).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,12).*ALGEBRAIC(:,8).*CONSTANTS(:,39).*CONSTANTS(:,40).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,12).*ALGEBRAIC(:,5).*CONSTANTS(:,39).*CONSTANTS(:,40).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,12).*ALGEBRAIC(:,8).*CONSTANTS(:,39).*ALGEBRAIC(:,7).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,12).*ALGEBRAIC(:,5).*CONSTANTS(:,39).*ALGEBRAIC(:,7).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,8).*ALGEBRAIC(:,6).*CONSTANTS(:,40).*ALGEBRAIC(:,9).*ALGEBRAIC(:,11)+ ALGEBRAIC(:,5).*ALGEBRAIC(:,6).*CONSTANTS(:,40).*ALGEBRAIC(:,9).*ALGEBRAIC(:,11)+ ALGEBRAIC(:,8).*CONSTANTS(:,39).*CONSTANTS(:,40).*ALGEBRAIC(:,9).*ALGEBRAIC(:,11)+ ALGEBRAIC(:,5).*CONSTANTS(:,39).*CONSTANTS(:,40).*ALGEBRAIC(:,9).*ALGEBRAIC(:,11)+ ALGEBRAIC(:,8).*CONSTANTS(:,39).*ALGEBRAIC(:,7).*ALGEBRAIC(:,9).*ALGEBRAIC(:,11)+ ALGEBRAIC(:,5).*CONSTANTS(:,39).*ALGEBRAIC(:,7).*ALGEBRAIC(:,9).*ALGEBRAIC(:,11)+ ALGEBRAIC(:,5).*CONSTANTS(:,39).*ALGEBRAIC(:,7).*ALGEBRAIC(:,15).*ALGEBRAIC(:,11)+ ALGEBRAIC(:,5).*ALGEBRAIC(:,6).*CONSTANTS(:,40).*ALGEBRAIC(:,13).*ALGEBRAIC(:,11)+ ALGEBRAIC(:,5).*CONSTANTS(:,39).*CONSTANTS(:,40).*ALGEBRAIC(:,13).*ALGEBRAIC(:,11)+ ALGEBRAIC(:,5).*CONSTANTS(:,39).*ALGEBRAIC(:,7).*ALGEBRAIC(:,13).*ALGEBRAIC(:,11)+ ALGEBRAIC(:,12).*ALGEBRAIC(:,8).*ALGEBRAIC(:,6).*CONSTANTS(:,40).*ALGEBRAIC(:,9)+ ALGEBRAIC(:,12).*ALGEBRAIC(:,5).*ALGEBRAIC(:,6).*CONSTANTS(:,40).*ALGEBRAIC(:,9)+ ALGEBRAIC(:,12).*ALGEBRAIC(:,8).*CONSTANTS(:,39).*CONSTANTS(:,40).*ALGEBRAIC(:,9)+ ALGEBRAIC(:,12).*ALGEBRAIC(:,5).*CONSTANTS(:,39).*CONSTANTS(:,40).*ALGEBRAIC(:,9)+ ALGEBRAIC(:,12).*ALGEBRAIC(:,8).*CONSTANTS(:,39).*ALGEBRAIC(:,7).*ALGEBRAIC(:,9)+ ALGEBRAIC(:,12).*ALGEBRAIC(:,5).*CONSTANTS(:,39).*ALGEBRAIC(:,7).*ALGEBRAIC(:,9)+ ALGEBRAIC(:,12).*ALGEBRAIC(:,5).*CONSTANTS(:,39).*ALGEBRAIC(:,7).*ALGEBRAIC(:,15)+ ALGEBRAIC(:,12).*ALGEBRAIC(:,5).*ALGEBRAIC(:,6).*CONSTANTS(:,40).*ALGEBRAIC(:,13)+ ALGEBRAIC(:,12).*ALGEBRAIC(:,5).*CONSTANTS(:,39).*CONSTANTS(:,40).*ALGEBRAIC(:,13)+ ALGEBRAIC(:,12).*ALGEBRAIC(:,5).*CONSTANTS(:,39).*ALGEBRAIC(:,7).*ALGEBRAIC(:,13));
    ALGEBRAIC(:,28) =  ALGEBRAIC(:,12).*ALGEBRAIC(:,8).*ALGEBRAIC(:,6).*CONSTANTS(:,40).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,4).*ALGEBRAIC(:,8).*ALGEBRAIC(:,6).*CONSTANTS(:,40).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,12).*CONSTANTS(:,38).*ALGEBRAIC(:,6).*CONSTANTS(:,40).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,4).*CONSTANTS(:,38).*ALGEBRAIC(:,6).*CONSTANTS(:,40).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,12).*ALGEBRAIC(:,5).*ALGEBRAIC(:,6).*CONSTANTS(:,40).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,12).*ALGEBRAIC(:,8).*CONSTANTS(:,39).*CONSTANTS(:,40).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,4).*ALGEBRAIC(:,8).*CONSTANTS(:,39).*CONSTANTS(:,40).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,12).*ALGEBRAIC(:,5).*CONSTANTS(:,39).*CONSTANTS(:,40).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,12).*ALGEBRAIC(:,8).*CONSTANTS(:,39).*ALGEBRAIC(:,7).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,4).*ALGEBRAIC(:,8).*CONSTANTS(:,39).*ALGEBRAIC(:,7).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,12).*ALGEBRAIC(:,5).*CONSTANTS(:,39).*ALGEBRAIC(:,7).*ALGEBRAIC(:,10)+ ALGEBRAIC(:,4).*ALGEBRAIC(:,8).*ALGEBRAIC(:,6).*CONSTANTS(:,40).*ALGEBRAIC(:,11)+ ALGEBRAIC(:,4).*CONSTANTS(:,38).*ALGEBRAIC(:,6).*CONSTANTS(:,40).*ALGEBRAIC(:,11)+ ALGEBRAIC(:,4).*ALGEBRAIC(:,8).*CONSTANTS(:,39).*CONSTANTS(:,40).*ALGEBRAIC(:,11)+ ALGEBRAIC(:,4).*ALGEBRAIC(:,8).*CONSTANTS(:,39).*ALGEBRAIC(:,7).*ALGEBRAIC(:,11);
    ALGEBRAIC(:,29) =  (1.00000./ALGEBRAIC(:,18)).* - ALGEBRAIC(:,2).*CONSTANTS(:,3).*ALGEBRAIC(:,6).*CONSTANTS(:,40).*ALGEBRAIC(:,9).*ALGEBRAIC(:,11);
    ALGEBRAIC(:,30) = (ALGEBRAIC(:,27)+ ALGEBRAIC(:,24).*CONSTANTS(:,32))./(ALGEBRAIC(:,21)+CONSTANTS(:,32));
    ALGEBRAIC(:,31) = (ALGEBRAIC(:,27)+ ALGEBRAIC(:,21).*power(CONSTANTS(:,29), 2.00000))./(ALGEBRAIC(:,24)+power(CONSTANTS(:,29), 2.00000));
    ALGEBRAIC(:,32) =  ALGEBRAIC(:,12).*ALGEBRAIC(:,8).*ALGEBRAIC(:,6).*CONSTANTS(:,40).*ALGEBRAIC(:,9)+ ALGEBRAIC(:,4).*ALGEBRAIC(:,8).*ALGEBRAIC(:,6).*CONSTANTS(:,40).*ALGEBRAIC(:,9)+ ALGEBRAIC(:,12).*CONSTANTS(:,38).*ALGEBRAIC(:,6).*CONSTANTS(:,40).*ALGEBRAIC(:,9)+ ALGEBRAIC(:,4).*CONSTANTS(:,38).*ALGEBRAIC(:,6).*CONSTANTS(:,40).*ALGEBRAIC(:,9)+ ALGEBRAIC(:,12).*ALGEBRAIC(:,5).*ALGEBRAIC(:,6).*CONSTANTS(:,40).*ALGEBRAIC(:,9)+ ALGEBRAIC(:,12).*ALGEBRAIC(:,8).*CONSTANTS(:,39).*CONSTANTS(:,40).*ALGEBRAIC(:,9)+ ALGEBRAIC(:,4).*ALGEBRAIC(:,8).*CONSTANTS(:,39).*CONSTANTS(:,40).*ALGEBRAIC(:,9)+ ALGEBRAIC(:,12).*ALGEBRAIC(:,5).*CONSTANTS(:,39).*CONSTANTS(:,40).*ALGEBRAIC(:,9)+ ALGEBRAIC(:,12).*ALGEBRAIC(:,8).*CONSTANTS(:,39).*ALGEBRAIC(:,7).*ALGEBRAIC(:,9)+ ALGEBRAIC(:,4).*ALGEBRAIC(:,8).*CONSTANTS(:,39).*ALGEBRAIC(:,7).*ALGEBRAIC(:,9)+ ALGEBRAIC(:,12).*ALGEBRAIC(:,5).*CONSTANTS(:,39).*ALGEBRAIC(:,7).*ALGEBRAIC(:,9)+ ALGEBRAIC(:,12).*ALGEBRAIC(:,5).*CONSTANTS(:,39).*ALGEBRAIC(:,7).*ALGEBRAIC(:,15)+ ALGEBRAIC(:,12).*ALGEBRAIC(:,5).*ALGEBRAIC(:,6).*CONSTANTS(:,40).*ALGEBRAIC(:,13)+ ALGEBRAIC(:,12).*ALGEBRAIC(:,5).*CONSTANTS(:,39).*CONSTANTS(:,40).*ALGEBRAIC(:,13)+ ALGEBRAIC(:,12).*ALGEBRAIC(:,5).*CONSTANTS(:,39).*ALGEBRAIC(:,7).*ALGEBRAIC(:,13);
    ALGEBRAIC(:,33) = ( 2.00000.*CONSTANTS(:,26).*CONSTANTS(:,37).*(ALGEBRAIC(:,26)+ ALGEBRAIC(:,29).*CONSTANTS(:,32)))./(ALGEBRAIC(:,21)+CONSTANTS(:,32));
    ALGEBRAIC(:,34) = ( 2.00000.*CONSTANTS(:,26).*CONSTANTS(:,37).*ALGEBRAIC(:,29).*power(CONSTANTS(:,29), 2.00000))./(ALGEBRAIC(:,24)+power(CONSTANTS(:,29), 2.00000));
    ALGEBRAIC(:,35) = power(ALGEBRAIC(:,30), 1.0 ./ 2);
    ALGEBRAIC(:,36) = ALGEBRAIC(:,17)+ALGEBRAIC(:,19)+ALGEBRAIC(:,23)+ALGEBRAIC(:,25)+ALGEBRAIC(:,28)+ALGEBRAIC(:,32);
    ALGEBRAIC(:,37) = ( CONSTANTS(:,37).*ALGEBRAIC(:,17))./ALGEBRAIC(:,36);
    ALGEBRAIC(:,38) = ( CONSTANTS(:,37).*ALGEBRAIC(:,19))./ALGEBRAIC(:,36);
    ALGEBRAIC(:,39) = ( CONSTANTS(:,37).*ALGEBRAIC(:,23))./ALGEBRAIC(:,36);
    ALGEBRAIC(:,40) = ( CONSTANTS(:,37).*ALGEBRAIC(:,25))./ALGEBRAIC(:,36);
    ALGEBRAIC(:,41) = ( CONSTANTS(:,37).*ALGEBRAIC(:,28))./ALGEBRAIC(:,36);
    ALGEBRAIC(:,42) = ( CONSTANTS(:,37).*ALGEBRAIC(:,32))./ALGEBRAIC(:,36);
    ALGEBRAIC(:,43) =   - CONSTANTS(:,26).*( CONSTANTS(:,24).*( ALGEBRAIC(:,12).*ALGEBRAIC(:,37) -  ALGEBRAIC(:,11).*ALGEBRAIC(:,42))+ (CONSTANTS(:,24)+ CONSTANTS(:,25).*CONSTANTS(:,23)).*( ALGEBRAIC(:,8).*ALGEBRAIC(:,38) -  ALGEBRAIC(:,13).*ALGEBRAIC(:,41))+ (CONSTANTS(:,24)+ CONSTANTS(:,25).*CONSTANTS(:,23)).*( ALGEBRAIC(:,6).*ALGEBRAIC(:,39) -  ALGEBRAIC(:,7).*ALGEBRAIC(:,40)));
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

Source
Derived from workspace Eskandari, Wright, Loo 2005 at changeset ca05388fbd9f.
Collaboration
To begin collaborating on this work, please use your git client and issue this command:
License
The terms of use/license for this work is unspecified.