Products & Services Solutions Academia Support User Community Company

Learn more about Spline Toolbox   

Cubic Spline Interpolation

Suppose you want to interpolate to some smooth data, e.g., to

rand('seed',6), x = (4*pi)*[0 1 rand(1,15)]; y = sin(x);

Then you could try the cubic spline interpolant obtained by

cs = csapi(x,y);

and plotted, along with the data, by

fnplt(cs); hold on, plot(x,y,'o'), set(gca,'Fontsize',16)
legend('cubic spline','data'), hold off

This produces a figure like the following.

Cubic Spline Interpolant to Some Smooth Data

This is, more precisely, the cubic spline interpolant with the not-a-knot end conditions, meaning that it is the unique piecewise cubic polynomial with two continuous derivatives with breaks at all interior data sites except for the leftmost and the rightmost one. It is the same interpolant as produced by the MATLAB spline command, spline(x,y).

  


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