nlm_mpd | R Documentation |
Simulates a midpoint displacement neutral landscape model.
nlm_mpd(
ncol,
nrow,
resolution = 1,
roughness = 0.5,
rand_dev = 1,
torus = FALSE,
rescale = TRUE,
verbose = TRUE
)
ncol |
[ |
nrow |
[ |
resolution |
[ |
roughness |
[ |
rand_dev |
[ |
torus |
[ |
rescale |
[ |
verbose |
[ |
The algorithm is a direct implementation of the midpoint displacement algorithm. It performs the following steps:
Initialization: Determine the smallest fit of
max(ncol, nrow)
in n^2 + 1 and assign value to n.
Setup matrix of size (n^2 + 1)*(n^2 + 1).
Afterwards, assign a random value to the four corners of the matrix.
Square Step: For each square in the matrix, assign the average of the four corner points plus a random value to the midpoint of that square.
Diamond Step: For each diamond in the matrix, assign the average of the four corner points plus a random value to the midpoint of that diamond.
At each iteration the roughness, an approximation to common Hurst exponent, is reduced.
RasterLayer
https://en.wikipedia.org/wiki/Diamond-square_algorithm
# simulate midpoint displacement
midpoint_displacememt <- nlm_mpd(ncol = 100,
nrow = 100,
roughness = 0.3)
## Not run:
# visualize the NLM
landscapetools::show_landscape(midpoint_displacememt)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.