| Spline Toolbox | Search  Help Desk |
| spcol | Examples See Also |
Generate the B-spline collocation matrix
Syntax
spcol(knots,k,tau) colloc = spcol(knots,k,tau,arg1,arg2)
Description
spcol constructs the matrix
with Bj the jth B-spline of ordercolloc:= (Dm(i)Bj(tau(i)))
k for the knot sequence knots, tau a sequence of points, assumed to be nondecreasing, and m = knt2mlt(tau), i.e.,
m(i) := #{j < i:tau(j) = tau(i)}
'slvblk', the matrix is returned in the almost block-diagonal format (specialized for splines) required by slvblk (and understood by bkbrk).
If one of the optional arguments is a string with the same first to letters as in 'sparse', then the matrix is returned in MATLAB's sparse format.
If one of the optional arguments is a string with the same first two letters as in 'noderiv', multiplicities are ignored, i.e., m(i) = 1 for all i.
Examples
The statementspcol([1:6],3,.1+[2:4]) provides the matrix
ans = 0.5900 0.0050 0 0.4050 0.5900 0.0050 0 0.4050 0.5900in which the typical row records the values at 2.1, or 3.1, or 4.1, of all B-splines of order 3 for the knot sequence
[1:6]. There are three such B-splines. The first one has knots 1,2,3,4, and its values are recorded in the first column. In particular, the last entry in the first column is zero since it gives the value of that B-spline at 4.1, a point to the right of its last knot.
By adding the optional argument 'sl', the output is instead a one-dimensional array containing the same information in storage-saving form. The M-file bkbrk decodes this information.
The statement bkbrk(spcol([1:6],3,.1+[2:4],'sl')); provides the following detailed information about the block structure of the matrix encoded in the information returned by spcol([1:6],3,.1+[2:4],'sl'):
block 1 has 2 row(s) 0.5900 0.0050 0 0.4050 0.5900 0.0050 next block is shifted over 1 column(s) block 2 has 1 row(s) 0.4050 0.5900 0.0050 next block is shifted over 2 column(s)
Algorithm
This is the most complex M-file in this toolbox since it has to deal with various ordering and blocking issues. The recurrence relations are used to generate, in lockstep, the values of all B-splines of orderk having anyone of the tau(i) in their support.
A separate calculation is carried out for the (presumably few) points at which derivative values are required. These are the points tau(i) with m(i) > 0. For these, and for every order k -j, j = j0, j0-1, ...,0, with j0 :=max(m), values of all B-splines of that order are generated by recurrence and used to compute the jth derivative at those points of all B-splines of order k.
The resulting rows of B-spline values (each row corresponding to a particular tau(i)) are then assembled into the overall (usually rather sparse) matrix.
When the optional argument 'sl' is present, these rows are instead assembled into a convenient almost-block-diagonal form that takes advantage of the fact that, at any point tau(i), at most k B-splines of order k are nonzero. This fact (together with the natural ordering of the B-splines) implies that the collocation matrix has a staircase shape, with the individual blocks or steps of varying height but of uniform width k.
The M-file slvblk is designed to take advantage of this storage-saving form available when determining the B-form of a pp function from interpolation or other approximation conditions.
See Also
slvblk, spapi, spap2
Limitations
The sequencetau is assumed to be nondecreasing.