| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This chapter describes functions for the computation of smoothing basis splines (B-splines). The header file ‘gsl_bspline.h’ contains prototypes for the bspline functions and related declarations.
| 38.1 Overview | ||
| 38.2 Initializing the B-splines solver | ||
| 38.3 Constructing the knots vector | ||
| 38.4 Evaluation of B-splines | ||
| 38.5 Example programs for B-splines | ||
| 38.6 References and Further Reading |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
B-splines are commonly used as basis functions to fit smoothing
curves to large data sets. To do this, the abscissa axis is
broken up into some number of intervals, where the endpoints
of each interval are called breakpoints. These breakpoints
are then converted to knots by imposing various continuity
and smoothness conditions at each interface. Given a nondecreasing
knot vector
, the
basis splines of order
are defined by
for
. The common case of cubic B-splines
is given by
. The above recurrence relation can be
evaluated in a numerically stable way by the de Boor algorithm.
If we define appropriate knots on an interval
then
the B-spline basis functions form a complete set on that interval.
Therefore we can expand a smoothing function as
given enough
data pairs. The
can
be readily obtained from a least-squares fit.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This function allocates a workspace for computing B-splines of order
k. The number of breakpoints is given by nbreak. This
leads to
basis functions. Cubic B-splines
are specified by
. The size of the workspace is
.
This function frees the memory associated with the workspace w.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This function computes the knots associated with the given breakpoints
and stores them internally in w->knots.
This function assumes uniformly spaced breakpoints on
and constructs the corresponding knot vector using the previously
specified nbreak parameter. The knots are stored in
w->knots.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This function evaluates all B-spline basis functions at the position
x and stores them in B, so that the
th element
of B is
. B must be of length
. This value is also stored in w->n.
It is far more efficient to compute all of the basis functions at
once than to compute them individually, due to the nature of the
defining recurrence relation.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The following program computes a linear least squares fit to data using
cubic B-spline basis functions with uniform breakpoints. The data is
generated from the curve
on
with gaussian noise added.
|
The output can be plotted with GNU graph.
$ ./a.out > bspline.dat $ graph -T ps -X x -Y y -x 0 15 -y -1 1.3 < bspline.dat > bspline.ps |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Further information on the algorithms described in this section can be found in the following book,
A large collection of B-spline routines is available in the PPPACK library available at http://www.netlib.org/pppack.
| [ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated by Autobuild on September, 26 2007 using texi2html 1.78.