fornberg(x, y, xs, k = 1)
k<=length(x)-1< code=""> required.
(length(xs))
, where the (k+1)-th column
gives the value of the k-th derivative. Especially the first column returns
the polynomial interpolation of the function.k
at xs
based on grid values at points in x
.
For k=0
this will evaluate the interpolating polynomial itself, but
call it with k=1
.neville
, newtonInterp
x <- 2 * pi * c(0.0, 0.07, 0.13, 0.2, 0.28, 0.34, 0.47, 0.5, 0.71, 0.95, 1.0)
y <- sin(0.9*x)
xs <- linspace(0, 2*pi, 51)
fornb <- fornberg(x, y, xs, 10)
matplot(xs, fornb, type="l")
grid()
Run the code above in your browser using DataLab