periodicSpline {splines} | R Documentation |
Create a Periodic Interpolation Spline
Description
Create a periodic interpolation spline, either from x
and
y
vectors, or from a formula/data.frame combination.
Usage
periodicSpline(obj1, obj2, knots, period, ord)
Arguments
obj1 |
Either a numeric vector of |
obj2 |
If |
knots |
An optional numeric vector of knot positions. |
period |
A positive numeric value giving the period for the
periodic spline. Defaults to |
ord |
A positive integer giving the order of the spline. Defaults
to 4. See |
Value
An object that inherits from class spline
. The object can be in
the B-spline representation, in which case it will be a
pbSpline
object, or in the piecewise polynomial representation
(a ppolySpline
object).
Author(s)
Douglas Bates and Bill Venables
See Also
splineKnots
,
interpSpline
Examples
library( splines )
xx <- seq( -pi, pi, len = 16 )[-1]
yy <- sin( xx )
frm <- data.frame( xx, yy )
print( pispl <- periodicSpline( xx, yy, period = 2 * pi ) )
print( pispl2 <- periodicSpline( yy ~ xx, frm, period = 2 * pi ) )
# pispl and pispl2 should be the same
plot( predict( pispl, seq(-3*pi, 3*pi, len = 101) ), type = "l" )
plot( pispl ) # displays over one period