Products & Services Solutions Academia Support User Community Company

Learn more about Spline Toolbox   

Knot Choices

It is, in fact, possible to specify explicitly just where the spline interpolant should have its breaks, using the command

sp = spapi(knots,x,y);

in which the sequence knots supplies, in a certain way, the breaks to be used. For example, recalling that we had chosen y to be sin(x), the command

ch = spapi(augknt(x,4,2),[x x],[y cos(x)]);

provides a cubic Hermite interpolant to the sine function, namely the piecewise cubic function, with breaks at all the x(i)'s, that matches the sine function in value and slope at all the x(i)'s. This makes the interpolant continuous with continuous first derivative but, in general, it has jumps across the breaks in its second derivative. Just how does this command know which part of the data value array [y cos(x)] supplies the values and which the slopes? Notice that the data site array here is given as [x x], i.e., each data site appears twice. Also notice that y(i) is associated with the first occurrence of x(i), and cos(x(i)) is associated with the second occurrence of x(i). The data value associated with the first appearance of a data site is taken to be a function value; the data value associated with the second appearance is taken to be a slope. If there were a third appearance of that data site, the corresponding data value would be taken as the second derivative value to be matched at that site. See The B-form for a discussion of the command augknt used here to generate the appropriate "knot sequence".

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS