# 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 byom_bioconc_extra.m and byom_bioconc_start.m. As input, it gets:

*t*is the time vector*X0*is a vector with the initial values for states*par*is the parameter structure*c*is the external concentration (or scenario number)

Time *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*.

- Author: Tjalling Jager
- Date: April 2017
- Web support: http://www.debtox.info/byom.html
- Back to index walkthrough_doseresp.html

## Contents

## Start

```
function Xout = simplefun(t,X0,par,c)
```

global glo % allow for global parameters in structure glo (handy for switches)

## Unpack initial states

The state variables enter this function in the vector _X_0.

```
Y = X0(1); % state 1 is the response at t=0
```

## 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, specified as explicit function(s):

```
x = glo.x_EC;
y = Y0 ./ (1+(x/(100-x))*(t/ECx).^beta);
Xout = [y]; % combine them into a matrix
```