# SpectralSynthesis: Generate a Landscape Using Fractional Brownian Motion In ecomodtools: Ecological Modelling Toolbox

## Description

A function to generate a multidimensional landscape as a realisation of a fractional Brownian motion process. This function uses an algorithm adapted from Keitt (2000) and corrected to adhere to a complex conjugacy condition described in Peitgen and Saupe (1988).

## Usage

 `1` ```SpectralSynthesis(DimExtents, Hursts, RescaleVals = c(0,1)) ```

## Arguments

 `DimExtents` An integer vector with the length of the desired output in each dimension. `length(DimExtents)` gives the number of dimensions in the output. `Hursts` A vector of Hurst exponents in each dimension. If `length(DimExtents)` is greater than `length(Hursts)` then the values are recycled. `RescaleVals` The outputs are scaled so that all values fall within `min(RescaleVals)` and `max(RescaleVals)`. If `RescaleVals` is `NULL` then the outputs are not rescaled and raw outputs are provided instead.

## Value

A vector of length `prod(DimExtents)` and with a dimensional extent attribute set to `DimExtents`. Each element contains the (possibly rescaled) output from a realisation of fractional Brownian motion.

## Note

It its current implementation, this algorithm creates a landscape with a length in each dimension equal to the smallest power of two that is greater than or equal to the largest value in `DimExtents`. The final landscape is created by taking the first `DimExtents` cells in the relevant dimension. This means that it will take just as long to create a landscape that has a `DimExtents` value of `c(4,4,100)` than it will to create a landscape with a `DimExtents` of `c(128,128,128)`. Because spectral synthesis methods are employed, the outputs from this function are periodic. If this is not desirable then it may be neccessary to generate landscapes that are two or three times larger than required and simply take the first few cells in each dimension.

## References

Keitt, T. H. (2000) Spectral representation of neutral landscapes. Landscape Ecology, 15, 479-493.

Peitgen, H. O. and Saupe, D. (1988) The Science of Fractal Images, Springer-Verlag.

With, K. A. (1997) The application of neutral landscape models in conservation biology. Conservation Biology, 11, 1069-1080.

With, K. A. and King A. W. (1997) The use and misuse of neutral landscapes models in ecology. Oikos, 79, 219-229.

`PercolationMap` `HierarchicalCurdling`
 ```1 2 3 4 5 6 7``` ```# Create a 128 x 128 landscape with a Hurst exponent of 0.5 in each dimension. # Output values are scaled between 0 and 5 dims.in <- rep(128,2) # Dimension extent input vector hursts <- rep(0.5,2) # 0.5 Hurst in both spatial dimensions rescaleVals <- c(0,5) # Rescale the outputs between 0 and 5 output.map <- SpectralSynthesis(dims.in, hursts, rescaleVals) image(output.map, col = heat.colors(100)) ```