Spline Toolbox | ![]() ![]() |
Put together a rational spline
Syntax
rp = rpmak(breaks,coefs) rp = rpmak(breaks,coefs,d) rs = rsmak(knots,coefs) rs = rsmak(shape
,parameters
)
Description
Both rpmak
and rsmak
put together a rational spline from minimal information. rsmak
is also equipped to provide rational splines that describe standard geometric shapes.
The command rpmak(breaks,coefs)
has the same effect as the command ppmak(breaks, coefs)
, -- except that the resulting ppform is tagged as a rational spline, i.e., as a rpform.
To describe what this means, let R be the piecewise-polynomial put together by the command ppmak(breaks,coefs)
, and let r(x) = s(x)/w(x) be the rational spline put together by the command rpmak(breaks,coefs)
. If v
is the value of R at x, then v(1:end-1)/v(end)
is the value of r at x. In other words, R(x) = [s(x);w(x)]. Correspondingly, the dimension of the target of r is one less than the dimension of the target of R. In particular, the dimension (of the target) of R must be at least 2, i.e., the coefficients specified by coefs
must be d
-vectors with d
> 1. See ppmak
for how the input arrays breaks
and coefs
are being interpreted, hence how they are to be specified in order to produce a particular piecewise-polynomial.
The commands ppmak(breaks,coefs,d)
and rpmak(breaks,coefs,d-1)
are similarly related. Note that the desire to have that optional third argument specify the dimension of the target requires different values for it in rpmak
and ppmak
for the same coefficient array coefs
.
The commands spmak(knots,coefs)
and rsmak(knots,coefs)
are also similarly related. In particular, rsmak(knots,coefs)
puts together a rational spline in B-form, i.e., it provides a rBform. See spmak
for how the input arrays knots
and coefs
are being interpreted, hence how they are to be specified in order to produce a particular piecewise-polynomial.
Finally, the command rsmak(
shape
,
parameters
)
provides a rational spline in rBform that describes the shape being specified by the string shape
and the optional additional parameters
. Specific choices are:
rsmak(`circle',radius,center) rsmak(`cone',radius,halfheight) rsmak(`cylinder',radius,height) rsmak(`southcap',radius,center)
From these, one may generate related shapes by affine transformations.
All fn...
commands except fnint
, fnder
, fndir
can handle rational splines.
Examples
runges = rsmak([-5 -5 -5 5 5 5],[1 1 1; 26 -24 26]); rungep = rpmak([-5 5],[0 0 1; 1 -10 26],1);
both provide a description of the rational polynomial r(x) = 1/(x2 + 1) on the interval [-5 .. 5]. However, outside the interval [-5 .. 5], the function given by runges
is zero, while the rational spline given by rungep
agrees with
1/(x2 + 1) for every x.
Figure 2-4, of a rotated cone, is generated by the commands
fnplt(fncmb(rsmak('cone',1,2),[0 0 -1;0 1 0;1 0 0])) axis equal, axis off, shading interp
Figure 2-4: A Rotated Cone Given By a Rational Quadratic Spline
For further, illustrated examples, see the section on "NURBS and Other Rational Splines" in the Tutorial.
See Also
![]() | ppmak | slvblk | ![]() |