Quantcast
Viewing all articles
Browse latest Browse all 18

Re: splines (particularly spap2)


"David Epstein" <David.Epstein.spam@remove.warwick.ac.uk> wrote in message
news:lkb2u1$61a$1@newscl01ah.mathworks.com...
> "John D'Errico" <woodchips@rochester.rr.com> wrote in message
> <lkaks0$mi8$1@newscl01ah.mathworks.com>...
> ...snip...
>> They all use cubic polynomials.
>
> @John: According to my reading of the documentation for spap2, what you
> say here is not correct. The documentation for spap2 claims to provide
> polynomial approximations of any desired degree.
>
> The degree or order is called k in the documentation. To discover the
> meaning of k to spap2, note that the Mathworks example of a cubic spline
> has k=4, and their example of a linear approximation has k=2.

Be careful. You're conflating two terms: order and degree. From the
definition of "Polynomials" as given in the glossary and used by Curve
Fitting Toolbox (and previously by Spline Toolbox):

http://www.mathworks.com/help/curvefit/list-of-terms-for-spline-fitting.html

"A univariate scalar-valued polynomial is specified by the list of its
polynomial coefficients. The length of that list is the order of that
polynomial, and, in this toolbox, the list is always stored as a row vector.
Hence an m-list of polynomials of order k is always stored as a matrix of
size [m,k]."

In SPAP2 the documentation specifically uses the term _order_ and not
_degree._ This matches the definition given on page 1 of de Boor's "A
Practical Guide to Splines." This is not surprising, given that Prof. de
Boor wrote the original version of the toolbox as stated in the
Acknowledgements section in the documentation:

http://www.mathworks.com/help/curvefit/curve-fitting-toolbox-splines-and-matlab-splines.html

Why does it use the order and not the degree? If you perform polynomial
addition and subtraction, the resulting polynomials may be of different
degree than the operands. But the order of the results is harder to change.
Consider the polynomial vector space with basis [x^4, x^3, x^2, x^1, x^0].
Let's write a few polynomials using that basis:

p = [0 0 1 2 3]; % x^2+2*x+3

p represents a polynomial of degree 2 and order 5.

q = [0 0 -1 1 0]; % -x^2+x

q also represents a polynomial of degree 2 and order 5.

r = p+q; 5 [0 0 0 3 3] % 3*x+3

r represents a polynomial of degree 1 and order 5. Even though the degree of
the polynomial it represents is different than the degree of p, its order is
the same and so we can add or subtract p and r perfectly fine using the +
operator. If instead we'd written p, q, and r using vectors whose lengths
are their degrees plus one:

p = [1 2 3];
q = [-1 1 0];
r = [3 3];

s = p+r; % error; matrix dimensions don't agree

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Viewing all articles
Browse latest Browse all 18

Trending Articles