This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

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.

fn2fm

Convert to specified form

Syntax

g = fn2fm(f,form)
sp = fn2fm(f,'B-',sconds)
fn2fm(f)

Description

g = fn2fm(f,form) describes the same function as is described by f, but in the form specified by the character vector form. Choices for form are 'B-', 'pp', 'BB', 'rB', 'rp', for the B-form, the ppform, the BBform, and the two rational spline forms, respectively.

The B-form describes a function as a weighted sum of the B-splines of a given order k for a given knot sequence, and the BBform (or, Bernstein-Bézier form) is the special case when each knot in that sequence appears with maximal multiplicity, k. The ppform describes a function in terms of its local polynomial coefficients. The B-form is good for constructing and/or shaping a function, while the ppform is cheaper to evaluate.

Conversion from a polynomial form to the corresponding rational form is possible only if the function in the polynomial form is vector-valued, in which case its last component is designated as the denominator. Converting from a rational form to the corresponding polynomial form simply reverses this process by reinterpreting the denominator of the function in the rational form as an additional component of the piecewise polynomial function.

Conversion to or from the stform is not possible at present.

If form is 'B-' (and f is in ppform), then the actual smoothness of the function in f across each of its interior breaks has to be guessed. This is done by looking, for each interior break, for the first derivative whose jump across that break is not small compared to the size of that derivative nearby. The default tolerance used in this is 1.e-12.

sp = fn2fm(f,'B-',sconds) permits you to supply, as the input argument sconds, a tolerance (strictly between 0 and 1) to be used in the conversion from ppform to B-form.

Alternatively, you can input sconds as a vector with integer entries, with at least as many entries as the ppform in f has interior breaks. In that case, sconds(i) specifies the number of smoothness conditions to be used across the ith interior break. If the function in f is a tensor product, then sconds, if given, must be a cell array.

fn2fm(f) converts a possibly old version of a form into its present version.

Examples

sp = fn2fm(spline(x,y),'B-') gives the interpolating cubic spline provided by the MATLAB® command spline, but in B-form rather than in ppform.

p0 = ppmak([0 1],[3 0 0]);
p1 = fn2fm(fn2fm(fnrfn(p0,[.4 .6]),'B-'),'pp');

gives p1 identical to p0 (up to round-off in the coefficients) since the spline has no discontinuity in any derivative across the additional breaks introduced by fnrfn, hence conversion to B-form ignores these additional breaks, and conversion to ppform does not retain any knot multiplicities (like the knot multiplicities introduced, by conversion to B-form, at the endpoints of the spline's basic interval).

Cautionary Note

When going from B-form to ppform, any jump discontinuity at the first and last knot, t(1) or t(end), will be lost since the ppform considers f to be defined outside its basic interval by extension of the first, respectively, the last polynomial piece. For example, while sp=spmak([0 1],1) gives the characteristic function of the interval [0..1], pp=fn2fm(spmak([0 1],1),'pp') is the constant polynomial, x|→1.

Algorithms

For a multivariate (tensor-product) function, univariate algorithms are applied in each variable.

For the conversion from B-form (or BBform) to ppform, the utility command sprpp is used to convert the B-form of all polynomial pieces to their local power form, using repeated knot insertion at the left endpoint.

The conversion from B-form to BBform is accomplished by inserting each knot enough times to increase its multiplicity to the order of the spline.

The conversion from ppform to B-form makes use of the dual functionals discussed in . Without further information, such a conversion has to ascertain the actual smoothness across each interior break of the function in f.

See Also

| | |