Language Reference |
computes a B-spline basis
Note that de Boor (2001) expresses B-splines in terms of order rather than degree; in his notation . B-splines have many interesting properties. For example:
A typical knot vector for calculating B-splines consists of exterior knots smaller than the smallest data value, and exterior knots larger than the largest data value. The remaining knots are the interior knots.
For example, consider the following statements and the output they produce:
x = {2.5 3 4.5 5.1}; knots = {0 1 2 3 4 5 6 7 8}; bsp = bspline(x,3,knots); print bsp[format=best7.];
0.02083 0.47917 0.47917 0.02083 0 0 0 0 0.16667 0.66667 0.16667 0 0 0 0 0 0.02083 0.47917 0.47917 0.02083 0 0 0 0 0.1215 0.65717 0.22117 0.00017In this example there are interior knots and the BSPLINE function returns a matrix with columns. If you pass an vector of data values, you can also rely on the BSPLINE function to compute a knot vector for you. For example, the following statements produce B-splines of degree 2 based on 4 equally spaced interior knots:
n = 20; x = ranuni(J(n,1,45)); bsp = bspline(x,2,.,4); print bsp[format=8.3];The resulting matrix is as follows:
0.000 0.104 0.748 0.147 0.000 0.000 0.000 0.000 0.000 0.000 0.286 0.684 0.030 0.000 0.000 0.000 0.000 0.000 0.000 0.517 0.483 0.000 0.000 0.000 0.217 0.725 0.058 0.000 0.000 0.000 0.239 0.713 0.048 0.000 0.000 0.000 0.000 0.000 0.446 0.553 0.002 0.000 0.000 0.000 0.394 0.600 0.006 0.000 0.000 0.000 0.000 0.000 0.000 0.064 0.729 0.207 0.000 0.389 0.604 0.007 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.500 0.500 0.000 0.000 0.000 0.000 0.210 0.728 0.062 0.000 0.000 0.014 0.639 0.347 0.000 0.000 0.000 0.001 0.546 0.453 0.000 0.000 0.000 0.500 0.500 0.000 0.000 0.000 0.000 0.000 0.304 0.672 0.024 0.000 0.000 0.000 0.000 0.000 0.020 0.659 0.322 0.000 0.000 0.000 0.000 0.277 0.690 0.033 0.000 0.000 0.000 0.386 0.606 0.007 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.022 0.667 0.311 0.008 0.612 0.380 0.000 0.000 0.000 0.000
Copyright © 2009 by SAS Institute Inc., Cary, NC, USA. All rights reserved.