# create b-splines
b1 = bspline(nbasis = 10)
b2 = bspline(nbasis = 12)
# observed data locations
x1 = seq(0, 1, len = 60)
x2 = seq(0, 1, len = 80)
# construct "true" data
mu = matrix(0, nrow = 60, ncol = 80)
for(i in seq_len(60)) {
for(j in seq_len(80)) {
mu[i, j] = sin(2*pi*(x1[i]-.5)^3)*cos(4*pi*x2[j])
}
}
# construct noisy data
data = mu + rnorm(60 * 80)
obj = prepare(data, list(x1, x2), list(b1, b2))
enhance.grid(obj, prepare = FALSE)
Run the code above in your browser using DataLab