pbsc {bspline} | R Documentation |
Polynomial B-spline Calculation of Basis Matrix
Description
Polynomial B-spline Calculation of Basis Matrix
Usage
pbsc(x, xk, coeffs)
Arguments
x |
Numeric,vector, abscissa points |
xk |
Numeric vector, knots |
coeffs |
Numeric 3D array, polynomial coefficients such as calculated by |
Details
Polynomials are calculated recursively by Cox-de Boor formula. However, it is not applied to
final values but to polynomial coefficients. Multiplication by a linear functions gives
a raise of polynomial degree by 1.
Polynomial coefficients stored in the first dimension of coeffs
are used as in
the following formula p[1]*x^n + p[1]*x^(n-1) + ... + p[n+1]
.
Resulting matrix is the same as returned by bsc(x, xk, n=dim(coeffs)[1]-1)
Value
Numeric matrix, basis vectors, one per column. Row number is length(x)
.
See Also
Examples
n=3
x=seq(0, 5, length.out=101)
xk=c(rep(0, n+1), 1:4, rep(5, n+1))
# cubic polynomial coefficients
coeffs=parr(xk)
# basis matrix
m=pbsc(x, xk, coeffs)
matplot(x, m, t="l")
stopifnot(all.equal.numeric(c(m), c(bsc(x, xk))))
[Package bspline version 2.2.2 Index]