Simulation of a dynamic model in Excel

 Simulation of a dynamic model in Excel It is shown how to implement and execute a dynamic model in Excel. Excel 2010 was used. As example we take a model of a population: x ( k  1)  r ( x ( k )  x ( k ) 2 ) where x represents a scaled population size, with parameter r and initial value x(1) = 0.1. This model is known as the discrete logistic model. We begin by creating three column headings, labelled as shown, in our Excel spreadsheet. (Skip a few lines at the top of the spreadsheet, as in the example below.) © Natal van Riel TU/e 1 Somewhere above your table headings, label a cell “r”, and enter the parameter value you want to use (here 1) in the cell next to it, like this: Next, enter the values of the initial time (1) and initial value (0.1) in the first two columns, as shown: © Natal van Riel TU/e 2 Next, we will complete the column of values of tijd, by using the fact that each time value is the previous time value plus 1. So, to compute the second time‐value in the time column, we enter the following formula into cell B6: =B5+1 This results in the value 2 appearing in cell B6. Now, highlight and drag cell B6 down the column, until you reach the desired ending value. (Pull down the small black square that appears in bottom‐right corner of a cell if you select a cell.) This will repeat the operation in B6 in all the lower cells. For example, if we choose to stop at tijd=10, our spreadsheet would look like this: © Natal van Riel TU/e 3 The computation model: nieuwe x = r*(x – x^2) We use the right‐hand side of the equation to compute the value for the first cell in the nieuwe x column. In D5 we enter: =$D$2*(C5‐C5^2) where we have substituted cell addresses in place of parameter r and variable x. Note the use of the $ in the cell address for parameter r. Our spreadsheet now looks like this: Next, we enter the next x‐value in the table. This is simply the first entry in the “nieuwe x” column. Hence, we enter the following into cell C6: =D5 This moves the value 0.09 into the x column. © Natal van Riel TU/e 4 Next, highlight the first cell in the last column, and drag them down one row to complete the second column of the table. We complete the table by highlighting the second entries in the last two columns, and dragging them down as far as the time‐column goes: © Natal van Riel TU/e 5 To extend the simulation for a longer time period, highlight the bottom row of the current table and drag it down as far as you want: © Natal van Riel TU/e 6 To create a plot of x versus time, select the first two columns, from the Insert tab, select a Scatter plot (choose one that will plot a line). The data in the first column will be automatically plotted on the x‐axis and the data in the second column will be on the y‐axis. Exercise Increase the rate constant r from 1 to 4, in a stepwise manner (try different values). © Natal van Riel TU/e 7