euler2D | R Documentation |
Simulation of the Wrapped Normal (WN) diffusion or Multivariate von Mises (MvM) diffusion by the Euler method in 2D, for several starting values.
euler2D(x0, A, mu, sigma, rho = 0, N = 100L, delta = 0.01, type = 1L,
maxK = 2L, expTrc = 30)
x0 |
matrix of size |
A |
drift matrix of size |
mu |
a vector of length |
sigma |
vector of length |
rho |
correlation coefficient of |
N |
number of discretization steps. |
delta |
discretization step. |
type |
integer giving the type of diffusion. Currently, only |
maxK |
maximum absolute value of the windings considered in the computation of the WN. |
expTrc |
truncation for exponential: |
An array of size c(nx0, 2, N + 1)
containing the nx0
discretized trajectories. The first slice corresponds to the matrix x0
.
N <- 100
nx0 <- 5
x0 <- seq(-pi, pi, l = nx0 + 1)[-(nx0 + 1)]
x0 <- as.matrix(expand.grid(x0, x0))
nx0 <- nx0^2
set.seed(12345678)
samp <- euler2D(x0 = x0, mu = c(0, 0), A = rbind(c(3, 1), 1:2),
sigma = c(1, 1), N = N, delta = 0.01, type = 2)
plot(x0[, 1], x0[, 2], xlim = c(-pi, pi), ylim = c(-pi, pi), pch = 16,
col = rainbow(nx0))
for (i in 1:nx0) linesTorus(samp[i, 1, ], samp[i, 2, ],
col = rainbow(nx0, alpha = 0.5)[i])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.