Products & Services Solutions Academia Support User Community Company

Learn more about 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,

diff(fnval(fnder(cs),[0 4*pi]))
ans = -.0100

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 csape which permits specification of many different kinds of end conditions, including periodic end conditions. So, use instead

pcs = csape(x,y,'periodic');

for which we get

diff(fnval(fnder(pcs),[0 4*pi]))
ans = 0

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

diff(fnval(fnder(pcs,2),[0 4*pi]))
ans = -4.6074e-015
  


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