Note: This page has been translated by MathWorks. Click here to see

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Acceptable knot sequence

`knots = aptknt(tau,k) `

[knots,k] = aptknt(tau,k)

`knots = aptknt(tau,k) `

returns a knot sequence suitable for interpolation at the data sites `tau`

by
splines of order k with that knot sequence, provided `tau`

has
at least `k`

entries, is nondecreasing, and satisfies `tau(i)`

<`tau(i+k-1)`

for
all `i`

. In that case, there is exactly one spline
of order `k`

with knot sequence `knots`

that
matches given values at those sites. This is so because the sequence `knots`

returned
satisfies the Schoenberg-Whitney conditions

knots(i) < tau(i) < knots(i+k), i=1:length(tau)

with equality only at the extreme knots, each of which occurs
with exact multiplicity `k`

.

If `tau`

has fewer than `k`

entries,
then `k`

is reduced to the value `length(tau)`

.
An error results if `tau`

fails to be nondecreasing
and/or `tau(i)`

equals `tau(i+k-1)`

for
some `i`

.

`[knots,k] = aptknt(tau,k) `

also
returns the actual `k`

used (which equals the smaller
of the input `k`

and `length(tau)`

).

If `tau`

is equally spaced, e.g., equal to `linspace(a,b,n)`

for
some `n`

>=4, and `y`

is a sequence
of the same size as `tau`

, then `sp = spapi(aptknt(tau,4),tau,y)`

gives
the cubic spline interpolant with the not-a-knot end condition. This
is the same cubic spline as produced by the command `spline(tau,y)`

,
but in B-form rather than ppform.

If `tau`

is very nonuniform, then use of the
resulting knot sequence for interpolation to data at the sites `tau`

may
lead to unsatisfactory results.

The `(k-1)`

-point averages `sum(tau(i+1:i+k-1))/(k-1)`

of
the sequence `tau`

, as supplied by `aveknt(tau,k)`

,
are augmented by a `k`

-fold `tau(1)`

and
a `k`

-fold `tau(end)`

. In other
words, the command gives the same result as `augknt([tau(1),aveknt(tau,k),tau(end)],k)`

,
provided `tau`

has at least `k`

entries
and `k `

is greater than 1.