Description Usage Arguments Value See Also Examples
This function simulates single realisation of a model on a 1D regular
spatial grid and regular grid of times using a function (closure) for advancing the state of the model, such as created by StepGillespie1D
.
1 |
x0 |
The initial state of the process at time |
t0 |
The initial time to be associated with the initial state |
tt |
The terminal time of the simulation. |
dt |
The time step of the output. Note that this time step relates only to the recorded output, and has no bearing on the accuracy of the simulation process. |
stepFun |
A function (closure) for advancing the state of the
process, such as produced by |
verb |
Output progress to the console (this function can be very slow). |
... |
Additional arguments will be passed to |
An R 3d array representing the simulated process. The dimensions are species, space, and time.
1 2 3 4 5 6 7 8 9 10 11 | data(spnModels)
N=20; T=30
x0=matrix(0,nrow=2,ncol=N)
rownames(x0)=c("x1","x2")
x0[,round(N/2)]=LV$M
stepLV1D = StepGillespie1D(LV,c(0.6,0.6))
xx = simTs1D(x0,0,T,0.2,stepLV1D,verb=TRUE)
op=par(mfrow=c(1,2))
image(xx[1,,],main="Prey",xlab="Space",ylab="Time")
image(xx[2,,],main="Predator",xlab="Space",ylab="Time")
par(op)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.