# NOT RUN {
testFn = function(x){
y = sin(2*pi*x*2)
}
#Get data
X = seq(0,1,0.1)
Y = testFn(X)
#Call gpHist function
gp_hist = gpHist(matrix(X),matrix(Y),sigma=0.01)
# New data to predict
x_pred = matrix(seq(0,1,0.01))
#Prediction
prediction = gpHistPredict(gp_hist,matrix( X), x_pred)
# Plot results
plot(X,Y)
lines(x_pred, prediction,col='red')
legend('topleft',legend=c('Data', 'Approximation'), col=c('black','red') ,lty=c(NA,1),pch=c(1,NA))
# }
Run the code above in your browser using DataLab