BYOM function simplefun.m (the model as explicit equations)

Syntax: Xout = simplefun(t,X0,par,c)

This function calculates the output of the model system. It is linked to the script files named byom_doseresp_*.m. Therefore, t is used for concentrations and c for time! (Note: BYOM normally works with 'time' on the x-axis). As input, it gets:

Variable t is handed over as a vector, and scenario name c as single number, by call_deri.m (you do not have to use them in this function). Output Xout (as matrix) provides the output for each state at each t.

Copyright (c) 2012-2019, Tjalling Jager, all rights reserved.
This source code is licensed under the MIT-style license found in the
LICENSE.txt file in the root directory of BYOM.



function Xout = simplefun(t,X0,par,c)
global glo   % allow for global parameters in structure glo (handy for switches)

Unpack parameters

The parameters enter this function in the structure par. The names in the structure are the same as those defined in the byom script file. The 1 between parentheses is needed as each parameter has 5 associated values.

ECx  = par.ECx(1);  % concentration for x% effect (x in glo.x_EC)
Y0   = par.Y0(1);   % response in control
beta = par.beta(1); % slope factor of the dose response

Calculate the model output

This is the actual model, the log-logistic dose-response curve, specified as explicit function.

x = glo.x_EC; % the effect level (as percentage)
y = Y0 ./ (1+(x/(100-x))*(t/ECx).^beta); % log-logistic dose-response function

Xout = [y]; % combine all outputs into a matrix