View source: R/simulateRACVM.R
simulateRACVM | R Documentation |
Simulates 2D correlated velocity movement model with rotation and advection
simulateRACVM( tau = 1, eta = 1, omega = 0, mu = 0, v0 = NULL, Tmax = 100, dt = 0.01 )
tau |
characteristic time scale of autocorrelation |
eta |
random speed parameter. In the case where ω = 0, the mean square speed of movement is E(|V|^2) = η^2 + μ^2. In the case were μ = ω = 0, the mean tangential speed is E(|V|) = η √(π)/2. |
omega |
rotational velocity |
mu |
advective velocity (can be complex value where real and imaginary parts are x and y components of velocity) |
v0 |
initial velocity |
Tmax |
max time |
dt |
time interval of simulation |
This function simulates a Rotational-Advective CVM explicitly using the governing OU equation, using a discretization in which dt << tau.
a list with the following elements
the time vector
the (complex) vector of velocities
the (complex) vector of locations
a two-column matrix of x-y coordinates of locations
a named list of model parameters.
estimateRACVM
require(smoove) racvm1 <- simulateRACVM(tau = 4, eta = 1, omega = 2, mu = 0, Tmax = 100, dt = .01) racvm2 <- simulateRACVM(tau = 4, eta = 1, omega = 0, mu = 1, Tmax = 100, dt = .01) racvm3 <- simulateRACVM(tau = 4, eta = 1, omega = 2, mu = 1, Tmax = 100, dt = .01) layout(rbind(c(1,2),c(1,3))) sapply(list(racvm1, racvm2, racvm3), function(x) with(x, plot( Z, asp = 1, type = "l", main = paste0("RACVM(", paste(unlist(parameters), collapse = ", "), ")") ))) racvm1 <- simulateRACVM(tau = 3, eta = 32, omega = .5, mu = 0, Tmax = 10, dt = .1) with(racvm1, scan_track(x = Re(Z), y = Im(Z), time = T)) # Compare with simulateRACVM2 # racvm1b <- simulateRACVM2(tau = 4, eta = 1, omega = 2, mu = 0, Tmax = 100, dt = .01) # racvm2b <- simulateRACVM2(tau = 4, eta = 1, omega = 0, mu = 1, Tmax = 100, dt = .01) # racvm3b <- simulateRACVM2(tau = 4, eta = 1, omega = 2, mu = 1, Tmax = 100, dt = .01) # # racvm1 <- simulateRACVM(tau = 4, eta = 1, omega = 1, mu = 0, Tmax = 10, dt = .01) # racvm1b <- simulateRACVM2(tau = 4, eta = 1, omega = 1, mu = 0, Tmax = 10, dt = .01) # with(racvm1, scan_track(x = Re(Z), y = Im(Z), time = T)) # with(racvm1b, scan_track(x = Re(Z), y = Im(Z), time = T))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.