ratinterp {pracma} | R Documentation |
Rational Interpolation
Description
Burlisch-Stoer rational interpolation.
Usage
ratinterp(x, y, xs = x)
Arguments
x |
numeric vector; points on the x-axis; needs to be sorted; at least three points required. |
y |
numeric vector; values of the assumed underlying function;
|
xs |
numeric vector; points at which to compute the interpolation;
all points must lie between |
Details
The Burlisch-Stoer approach to rational interpolation is a recursive procedure (similar to the Newton form of polynomial interpolation) that produces a “diagonal” rational function, that is the degree of the numerator is either the same or one less than the degree of the denominator.
Polynomial interpolation will have difficulties if some kind of singularity
exists in the neighborhood, even if the pole occurs in the complex plane.
For instance, Runge's function has a pole at z = 0.2 i
, quite close
to the interval [-1, 1]
.
Value
Numeric vector representing values at points xs
.
Note
The algorithm does not yield a simple algebraic expression for the rational function found.
References
Stoer, J., and R. Bulirsch (2002). Introduction to Numerical Analysis. Third Edition, Springer-Verlag, New York.
Fausett, L. V. (2008). Applied Numerical Analysis Using Matlab. Second Edition, Pearson Education.
See Also
Examples
## Rational interpolation of Runge's function
x <- c(-1, -0.5, 0, 0.5, 1.0)
y <- runge(x)
xs <- linspace(-1, 1)
ys <- runge(xs)
yy <- ratinterp(x, y, xs) # returns exactly the Runge function
## Not run:
plot(xs, ys, type="l", col="blue", lty = 2, lwd = 3)
points(x, y)
yy <- ratinterp(x, y, xs)
lines(xs, yy, col="red")
grid()
## End(Not run)