I wrote this Neville's method in R, but I am familiar with Matlab too. So any of your comments in either R or Matlab are really great to me.
Base on these data points:
x= 1.5
xi = c(1,1.3,1.6,1.9,2.2)
fi = c(0.7651977, 0.6200860, 0.4554022, 0.2818186, 0.1103623)
and below is my script in R:
neville <- function(x,xi,fi){
n <- length(xi) - 1
Q <- matrix(0, n+1, n+1)
Q[,1] = fi
for (i in 1:n) {
for (j in 1:i){
Q[i+1,j+1] <- ((x - xi[i-j +1])*Q[i+1,j] - (x - xi[i+1])
*Q[i,j])/(xi[i+1] - xi[i-j+1])
}
}
return (Q)
}
Clearly that, my output is in the form of matrix. So, can anyone show me how to plot the interpolation for this Neville's method to represent my xi and fi points ?