Spline Toolbox | ![]() ![]() |
From knots to breaks and/or their multiplicities
Syntax
[breaks, mults] = knt2brk(knots)
[m, sortedt] = knt2mlt(t)
Description
The commands extract the distinct elements from a sequence, as well as their multiplicities in that sequence, with multiplicity taken in two slightly different senses.
The statement knt2brk(knots)
returns the distinct elements in knots
, and in increasing order. The optional second output argument provides the multiplicity with which each distinct element occurs in knots
. In particular, the two outputs, breaks
and mults
, are of the same length, and knt2brk
is complementary to brk2knt
in that, for any knot sequence knots,
the two commands [xi,mlts] = knt2brk(knots); knots1 = brk2knt(xi,mlts);
give knots1
equal to knots
.
The statement m = knt2mlt(t)
returns a vector of the same length as t
, with m(i)
counting the number of entries to the left of the
ith entry in sortedt
= sort(t)
that are equal to that entry. This kind of multiplicity vector is needed in spapi
or spcol
where such multiplicity is taken to specify which particular derivatives are to be matched at the sites in t
. Precisely, if t
is nondecreasing and z
is a vector of the same length, then sp = spapi(knots, t, z)
attempts to construct a spline s (with knot sequence knots
) for which , all i. The optional second argument returns the output from
sort(t)
.
Neither knt2brk
nor knt2mlt
is likely to be used by the casual user of this toolbox.
Examples
[xi,mlts]=knt2brk([1 2 3 3 1 3])
returns [1 2 3]
for xi
and [2 1 3]
for mlts
.
[m,t]=knt2mlt([1 2 3 3 1 3])
returns [0 1 0 0 1 2]
for m
and [1 1 2 3 3 3]
for t
.
See Also
![]() | getcurve | newknt | ![]() |