# a very simple uniform kernel
uniform_kernel <- calculate_dispersal_kernel(
max_dispersal_dist = 3,
kfun = function(x) {
x * 0 + 1
}
)
# same as
stopifnot(
uniform_kernel == matrix(1 / 49, nrow = 7, ncol = 7)
)
# now a negative exponential kernel
# not that `mean_dispersal_dist`
# is passed to the kernel function.
calculate_dispersal_kernel(
max_dispersal_dist = 3,
kfun = negative_exponential_function,
mean_dispersal_dist = 1
)
Run the code above in your browser using DataLab