Spline Toolbox    

Periodic Data

We know that the sine function is -periodic. To check how well our interpolant does on that score, we compute, e.g., the difference in the value of its first derivative at the two endpoints,

which is not so good. If you prefer to get an interpolant whose first and second derivatives at the two endpoints, 0 and 4*pi, match, use instead the command cspape which permits specification of many different kinds of end conditions, including periodic end conditions. So, use instead

for which we get

as the difference of end slopes. Even the difference in end second derivatives is small:


  Cubic Spline Interpolation Other End Conditions