Documentation |
On this page… |
---|
Spline Function Naming Conventions |
Curve Fitting Toolbox™ spline functions contain versions of the essential MATLAB^{®} programs of the B-spline package (extended to handle also vector-valued splines) as described in A Practical Guide to Splines, (Applied Math. Sciences Vol. 27, Springer Verlag, New York (1978), xxiv + 392p; revised edition (2001), xviii+346p), hereafter referred to as PGS. The toolbox makes it easy to create and work with piecewise-polynomial functions.
The typical use envisioned for this toolbox involves the construction and subsequent use of a piecewise-polynomial approximation. This construction would involve data fitting, but there is a wide range of possible data that could be fit. In the simplest situation, one is given points (ti,yi) and is looking for a piecewise-polynomial function f that satisfies f(ti) = yi, all i, more or less. An exact fit would involve interpolation, an approximate fit might involve least-squares approximation or the smoothing spline. But the function to be approximated may also be described in more implicit ways, for example as the solution of a differential or integral equation. In such a case, the data would be of the form (Af)(ti), with A some differential or integral operator. On the other hand, one might want to construct a spline curve whose exact location is less important than is its overall shape. Finally, in all of this, one might be looking for functions of more than one variable, such as tensor product splines.
Care has been taken to make this work as painless and intuitive as possible. In particular, the user need not worry about just how splines are constructed or stored for later use, nor need the casual user worry about such items as "breaks" or "knots" or "coefficients". It is enough to know that each function constructed is just another variable that is freely usable as input (where appropriate) to many of the commands, including all commands beginning with fn, which stands for function. At times, it may be also useful to know that, internal to the toolbox, splines are stored in different forms, with the command fn2fm available to convert between forms.
At present, the toolbox supports two major forms for the representation of piecewise-polynomial functions, because each has been found to be superior to the other in certain common situations. The B-form is particularly useful during the construction of a spline, while the ppform is more efficient when the piecewise-polynomial function is to be evaluated extensively. These two forms are almost exactly the B-representation and the pp representation used in A Practical Guide to Splines.
But, over the years, the Curve Fitting Toolbox spline functions have gone beyond the programs in A Practical Guide to Splines. The toolbox now supports the `scattered translates' form, or stform, in order to handle the construction and use of bivariate thin-plate splines, and also two ways to represent rational splines, the rBform and the rpform, in order to handle NURBS.
Splines can be very effective for data fitting because the linear systems to be solved for this are banded, hence the work needed for their solution, done properly, grows only linearly with the number of data points. In particular, the MATLAB sparse matrix facilities are used in the Curve Fitting Toolbox spline functions when that is more efficient than the toolbox's own equation solver, slvblk, which relies on the fact that some of the linear systems here are even almost block diagonal.
All polynomial spline construction commands are equipped to produce bivariate (or even multivariate) piecewise-polynomial functions as tensor products of the univariate functions used here, and the various fn... commands also work for these multivariate functions.
There are various examples, all accessible through the Demos tab in the MATLAB Help browser. You are strongly urged to have a look at some of them, or at the GUI splinetool, before attempting to use this toolbox, or even before reading on.
The MATLAB technical computing environment provides spline approximation via the command spline. If called in the form cs = spline(x,y), it returns the ppform of the cubic spline with break sequence x that takes the value y(i) at x(i), all i, and satisfies the not-a-knot end condition. In other words, the command cs = spline(x,y) gives the same result as the command cs = csapi(x,y) available in the Curve Fitting Toolbox spline functions. But only the latter also works when x,y describe multivariate gridded data. In MATLAB, cubic spline interpolation to multivariate gridded data is provided by the command interpn(x1,...,xd,v,y1,...,yd,'spline') which returns values of the interpolating tensor product cubic spline at the grid specified by y1,...,yd.
Further, any of the Curve Fitting Toolbox spline fn... commands can be applied to the output of the MATLAB spline(x,y) command, with simple versions of the Curve Fitting Toolbox spline commands fnval, ppmak, fnbrk available directly in MATLAB, as the commands ppval, mkpp, unmkpp, respectively.
The Curve Fitting Toolbox spline functions started out as an extension of the MATLAB environment of interest to experts in spline approximation, to aid them in the construction and testing of new methods of spline approximation. Such people will have mastered the material in A Practical Guide to Splines.
However, the basic commands for constructing and using spline approximations are set up to be usable with no more knowledge than it takes to understand what it means to, say, construct an interpolant or a least squares approximant to some data, or what it means to differentiate or integrate a function.
With that in mind, there are sections, like Cubic Spline Interpolation, that are meant even for the novice, while sections devoted to a detailed example, like the one on constructing a Chebyshev spline or on constructing and using tensor products, are meant for users interested in developing their own spline commands.
"Glossary" provides definitions of almost all the mathematical terms used in the splines documentation.
The Curve Fitting Toolbox spline functions can handle vector-valued splines, i.e., splines whose values lie in R^{d}. Since MATLAB started out with just one variable type, that of a matrix, there is even now some uncertainty about how to deal with vectors, i.e., lists of numbers. MATLAB sometimes stores such a list in a matrix with just one row, and other times in a matrix with just one column. In the first instance, such a 1-row matrix is called a row-vector; in the second instance, such a 1-column matrix is called a column-vector. Either way, these are merely different ways for storing vectors, not different kinds of vectors.
In this toolbox, vectors, i.e., lists of numbers, may also end up stored in a 1-row matrix or in a 1-column matrix, but with the following agreements.
A point in R^{d}, i.e., a d-vector, is always stored as a column vector. In particular, if you want to supply an n-list of d-vectors to one of the commands, you are expected to provide that list as the n columns of a matrix of size [d,n].
While other lists of numbers (e.g., a knot sequence or a break sequence) may be stored internally as row vectors, you may supply such lists as you please, as a row vector or a column vector.
Most of the spline commands in this toolbox have names that follow one of the following patterns:
cs... commands construct cubic splines (in ppform)
sp... commands construct splines in B-form
fn... commands operate on spline functions
..2.. commands convert something
..api commands construct an approximation by interpolation
..aps commands construct an approximation by smoothing
..ap2 commands construct a least-squares approximation
...knt commands construct (part of) a particular knot sequence
...dem commands are examples.
Note See the "Glossary" for information about notation. |
For ease of use, most Curve Fitting Toolbox spline functions have default arguments. In the reference entry under Syntax, we usually first list the function with all necessary input arguments and then with all possible input arguments. When there is more than one optional argument, then, sometimes, but not always, their exact order is immaterial. When their order does matter, you have to specify every optional argument preceding the one(s) you are interested in. In this situation, you can specify the default value for an optional argument by using [] (the empty matrix) as the input for it. The description in the reference page tells you the default value for each optional input argument.
As in MATLAB, only the output arguments explicitly specified are returned to the user.
MathWorks^{®} would like to acknowledge the contributions of Carl de Boor to the Curve Fitting Toolbox spline functions. Professor de Boor authored the Spline Toolbox™ from its first release until Version 3.3.4 (2008).
Professor de Boor received the John von Neumann Prize in 1996 and the National Medal of Science in 2003. He is a member of both the American Academy of Arts and Sciences and the National Academy of Sciences. He is the author of A Practical Guide to Splines (Springer, 2001).
Some of the spline function naming conventions are the result of a discussion with Jörg Peters, then a graduate student in Computer Sciences at the University of Wisconsin-Madison.