rangoPractico <- 30
## Definición de la malla
desde <- 0
hasta <- 120
x.seq <- seq(desde, hasta, length=200)
y.seq <- seq(desde, hasta, length=200)
require(RandomFields)
## Loading required package: RandomFields
## Loading required package: sp
## Loading required package: RandomFieldsUtils
## This is RandomFields Version: 3.1.36
## 
## Attaching package: 'RandomFields'
## The following object is masked from 'package:RandomFieldsUtils':
## 
##     RFoptions
## The following objects are masked from 'package:base':
## 
##     abs, acosh, asin, asinh, atan, atan2, atanh, cos, cosh, exp,
##     expm1, floor, gamma, lgamma, log, log1p, log2, logb, max, min,
##     round, sin, sinh, sqrt, tan, tanh, trunc
modeloExp <- RMexp(var = 2, scale = rangoPractico/3) + RMtrend(mean = 5)

RFoptions(seed = 7)
simuExp <- RFsimulate(modeloExp, x = x.seq, y = y.seq)
## NOTE: simulation is performed with fixed random seed 7.
## Set 'RFoptions(seed=NA)' to make the seed arbitrary.
## New output format of RFsimulate: S4 object of class 'RFsp';
## for a bare, but faster array format use 'RFoptions(spConform=FALSE)'.
image(simuExp, asp = 1, col = terrain.colors(100))

modeloGau <- RMgauss(var = 2, scale = rangoPractico/sqrt(3)) + RMtrend(mean = 5)

RFoptions(seed = 7)
simuGau <- RFsimulate(modeloGau, x = x.seq, y = y.seq)
## NOTE: simulation is performed with fixed random seed 7.
## Set 'RFoptions(seed=NA)' to make the seed arbitrary.
image(simuGau, asp = 1, col = terrain.colors(100))

# Cálculo del variograma empírico de los datos simulados Exponencial
varioempE<-RFempiricalvariogram(data=simuExp)
png("figura1.png", width = 650, height = 480)
plot(varioempE,model=modeloExp)
dev.off()
## png 
##   2
# Cálculo del variograma empírico de los datos simulados Gaussianos
varioempG<-RFempiricalvariogram(data=simuGau)
png("figura2.png", width = 650, height = 480)
plot(varioempG,model=modeloGau)
dev.off()
## png 
##   2