# Infection Dynamic Model (Model Definition GUI)

This page shows how to prepare the Infection Dynamic Model in the Graphical User interface of COSSAN-X.

## Input

Suppose to consider a small village with an initial population of 1000 individuals.

### Parameter

In the GUI a parameters object named S0 is defined with a values = 1000 as shown in the figure:

### Random Variables

Four Random Variable object are used to model different parameter of the Infection model. More specifically 3 random variables with uniformly distributed between 0 and 1 are used to model the infection coefficient, the recovery rate and the death rate respectively. The contact coefficient is modelled using a beta distribution with parameter 2 and 7.

## Evaluator

A Matlab script is then used to model the infection spread coefficient (Y).

### Matlab script (Single Array I/O)

In this example we use single array for the Input / Output interaction. Order of the input factors The order of the input factors defined in the Matlab script is important when Single Array is used

The following matlab script is used to model the infection spread coefficient.

```% INPUT
% S0 if the first column of the matrix Minput
% gamma is the second column of the matrix Minput
% kappa is the third column of the matrix Minput
% r is the forth column of the matrix Minput
% delta is the fifth column  of the matrix Minput
% OUTPUT
% We have only 1 output that is the column of the matrix Moutput

% Y = gamma.*kappa.*Szero-r-delta;
Moutput=Minput(:,2).* Minput(:,3).* Minput(:,1)-Minput(:,4) - Minput(:,5);

% The .* means Element-by-element multiplication
```

### Matlab script (Structure I/O)

Alternative a Matlab script where the Input and Output are passes as a structure can be used. It is necessary to select the appropriate Matlab I/O type as shown below.

The Matlab script used is:

```% Matlab Script Template

% =========================================================================
% COSSAN working group,
% E: info@cossan.co.uk
% W: www.cossan.co.uk
% =========================================================================

% Cycle over realizations (samples)
% % DO NOT REMOVE THIS CYCLE
for n= 1:length(Tinput)