interpol {lazy.tools}R Documentation

Interpolation of data

Description

Interpolation of data

Usage

interpol(
  x,
  y,
  xout = NULL,
  method = "natural",
  n = 3 * length(x),
  print = 0,
  plot = 0
)

Arguments

x

input vector

y

input vector

xout

vector at which y is calculated, or NULL.

method

= "constant" or "linear" or "natural"
"spline" can be uses as an alias for "natural".

n

# of points in (min(x), max(x)) at which y is calculated when xout is NULL.

print

= 1 to print the result

plot

= 1 to plot the result

Value

A matrix: cbind( xout, yout )

Examples

x <- c(1,2,3,4,5,6)
y <- c(1,4,9,7,6,8)
xout <- seq(1, 7, length=10)
sp=interpol( x, y, xout, method="constant", plot=1 )
sp=interpol( x, y, xout, method="linear", plot=1 )
sp=interpol( x, y, xout, method="spline", plot=1 )

[Package lazy.tools version 0.1.6 ]