library(Matrix)
mesh <- fm_mesh_1d(-20:120, degree = 2)
Q <- fm_matern_precision(mesh, alpha = 2, rho = 15, sigma = 1)
x <- seq(0, 100, length.out = 601)
A <- fm_basis(mesh, x)
plot(x,
as.vector(Matrix::diag(fm_covariance(Q, A))),
type = "l",
ylab = "marginal variances"
)
plot(x,
fm_evaluate(mesh, loc = x, field = fm_sample(1, Q)[, 1]),
type = "l",
ylab = "process sample"
)
Run the code above in your browser using DataLab