# BYOM function call_deri.m (calculates the model output)

`Syntax: [Xout,TE] = call_deri(t,par,X0v)`

This package does not use the ODE solver, so this function is simplified. However, we keep some things in here to make this package in line with the general flow of BYOM. This function calls the explicit function(s) in simplefun.m. As input, it gets:

• t the time vector (in this package: concentration)
• par the parameter structure
• X0v a vector with initial states and one concentration (not used)

The output Xout provides a matrix with exposure concentration in rows, and states in columns.

```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.```

## Start

```function [Xout,TE] = call_deri(t,par,X0v)
```
```global glo   % allow for global parameters in structure glo
```

## Initial settings

```% Unpack the vector X0v, which is X0mat for one scenario
X0 = X0v(2:end); % these are the intitial states for a scenario
% In the dose-response package, this is not used. However, _X_0 remains in
% this function to keep it in line with the rest of BYOM.

TE = +inf; % this is needed for compatibaility with rest of BYOM
```

## Calculations

This part calls the explicit model in simplefun.m) to calculate the output (the value of the state variables over time). There is generally no need to modify this part. Note that in the dose-response package, t is used for the concentration!

```c  = X0v(1);     % the concentration (or scenario number)
t  = t(:);       % force t to be a row vector (needed when useode=0)

% use an explicit function provided in simplefun!
Xout = simplefun(t,X0,par,c);
```

## Output mapping

Xout contains a row for each state variable. It can be mapped to the data. If you need to transform the model values to match the data, do it here.

```% Xout(:,1) = Xout(:,1).^3; % e.g., do something on first column, like cube it ...
```