Main Content

knt2brk, knt2mlt

Convert knots to breaks and their multiplicities

Syntax

knt2brk(knots)
[breaks,mults] = knt2brk(knots)
m = knt2mlt(t)
[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.

knt2brk(knots) returns the distinct elements in knots, and in increasing order, hence is the same as unique(knots).

[breaks,mults] = knt2brk(knots) additionally provides, in mults, the multiplicity with which each distinct element occurs in knots. Explicitly, 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.

m = knt2mlt(t) returns a vector of the same length as t, with m(i) counting, in the vector sort(t), the number of entries before its ith entry 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 Dm(i)s(t(i)) equals z(i), all i.

[m,sortedt] = knt2mlt(t) also 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

| |