Learn R Programming

pomp (version 0.24-7)

B-splines: B-spline bases

Description

These functions generate B-spline basis functions. bspline.basis gives a basis of spline functions. periodic.bspline.basis gives a basis of periodic spline functions.

Usage

bspline.basis(x, nbasis, degree = 3)
periodic.bspline.basis(x, nbasis, degree = 3, period = 1)

Arguments

x
Vector at which the spline functions are to be evaluated.
nbasis
The number of basis functions to return.
degree
Degree of requested B-splines.
period
The period of the requested periodic B-splines.

Value

  • bspline.basisReturns a matrix with length(x) rows and nbasis columns. Each column contains the values one of the spline basis functions.
  • periodic.bspline.basisReturns a matrix with length(x) rows and nbasis columns. The basis functions returned are periodic with period period.

Examples

Run this code
x <- seq(0,2,by=0.01)
y <- bspline.basis(x,degree=3,nbasis=9)
matplot(x,y,type='l',ylim=c(0,1.1))
lines(x,apply(y,1,sum),lwd=2)

x <- seq(-1,2,by=0.01)
y <- periodic.bspline.basis(x,nbasis=5)
matplot(x,y,type='l')

Run the code above in your browser using DataLab