Learn R Programming

FieldSim (version 2.1)

fieldsim: Random field simulation by the fieldsim method

Description

The function fieldsim yields discretization of sample path of a Gaussian field following the procedure described in Brouste et al. (2007).

Usage

fieldsim(S,Elevel=1,Rlevel=5,nbNeighbor=4)

Arguments

S
a covariance function (defined on $[0,1]^4$) of a Random field to simulate.
Elevel
a positive integer. $\code{Elevel}$ is the level associated with the regular space discretization for the first step of the algorithm (Accurate simulation step). The regular space discretization is of the following form: $[[0:2^{\code{Elevel}}]/
Rlevel
a positive integer. $\code{Elevel}+\code{Rlevel}$ is the level associated with the regular space discretization for the second step of the algorithm (Refined simulation step). The regular space discretization is of the following form: $[[0:2^{\code
nbNeighbor
a positive integer. nbNeighbor must be between 1 and 32. nbNeighbor is the number of neighbors to use in the second step of the algorithm.

Value

  • A list with the following components:
  • Zrowthe vector of length $2^{\code{Elevel}+\code{Rlevel}}+1$ containing the discretization of the x axis.
  • Zcolthe vector of length $2^{\code{Elevel}+\code{Rlevel}}+1$ containing the discretization of the y axis.
  • Zthe matrix of size $(2^{\code{Elevel}+\code{Rlevel}}+1)$x$(2^{\code{Elevel}+\code{Rlevel}}+1)$ in such a way Z[i,j] containing the value of the process at point (Zrow[i],Zcol[j])
  • timethe CPU time

encoding

latin1

Details

The function fieldsim yields discretization of sample path of a Gaussian field associated with the covariance function given by R. The subspace [0,1]x[0,1] is discretized in a regular space discretization of size $(2^{\code{Elevel}+\code{Rlevel}}+1)^2$. At each point of the grid, the Gaussian field is simulated using the procedure described in Brouste et al. (2007).

References

A. Brouste, J. Istas and S. Lambert-Lacroix (2007). On Gaussian random fields simulations.

See Also

quadvar,spheresim,hypersim.

Examples

Run this code
# Load FieldSim library
library(FieldSim)

# Example 1: Fractional Brownian Field
R<-function(x,H=0.9){1/2*((x[1]^2+x[2]^2)^(H)+(x[3]^2+x[4]^2)^(H)-((x[1]-x[3])^2+(x[2]-x[4])^2)^(H))}
res<- fieldsim(R,Elevel=1,Rlevel=5,nbNeighbor=4)
x <- res$Zrow
y <- res$Zcol
z <- res$Z
persp(x, y, z, theta = 30, phi = 30, expand = 0.5, col = "lightblue")

# Example 2: Multifractional Brownian Field
F<-function(y){0.4*y+0.5}
R<-function(x,Fun=F){
H1<-Fun(x[1])
H2<-Fun(x[3])
alpha<-1/2*(H1+H2)
C2D(alpha)^2/(2*C2D(H1)*C2D(H2))*((x[1]^2+x[2]^2)^(alpha)+(x[3]^2+x[4]^2)^(alpha)-((x[1]-x[3])^2+(x[2]-x[4])^2)^(alpha))
}
res<- fieldsim(R,Elevel=1,Rlevel=5,nbNeighbor=4)
x <- res$Zrow
y <- res$Zcol
z <- res$Z
persp(x, y, z, theta = 30, phi = 30, expand = 0.5, col = "lightblue")

Run the code above in your browser using DataLab