Example 1.3

Interpolation of Runge function using splines

Contents

Define Vectors

x = [-1:0.01:1];
X = [-1:0.20:1];

y = 1./(1+25*x.^2);
Y = 1./(1+25*X.^2);

Cubic spline interpolation

Free end condition

interp = naturalCubicSpline(X,Y,x);

Generates plots

plot(x,interp,'k-',X,Y,'k.');
legend('Cubic Spline','Data Points');
axis([-1 1 0 1.2]);