Learn R Programming

rSPDE (version 2.5.1)

simulate.rSPDEobj1d: Simulation of a Matern field using a rational SPDE approximation

Description

The function samples a Gaussian random field based on a pre-computed rational SPDE approximation.

Usage

# S3 method for rSPDEobj1d
simulate(object, nsim = 1, seed = NULL, ...)

Value

A matrix with the n samples as columns.

Arguments

object

The rational SPDE approximation, computed using matern.rational().

nsim

The number of simulations.

seed

an object specifying if and how the random number generator should be initialized (‘seeded’).

...

Currently not used.

See Also

matern.rational()

Examples

Run this code
# Sample a Gaussian Matern process on R using a rational approximation
range <- 0.2
sigma <- 1
nu <- 0.8

# compute rational approximation
x <- seq(from = 0, to = 1, length.out = 100)
op <- matern.rational(
  range = range, sigma = sigma,
  nu = nu, loc = x
)

# Sample the model and plot the result
Y <- simulate(op)
plot(x, Y, type = "l", ylab = "u(x)", xlab = "x")

Run the code above in your browser using DataLab