This method has advantages over the use of high degree polynomial, which have tendency to oscillate between data values. This method is a series of third degree polynomials joining the points together. Only four unknown coefficients need to computed to construct the cubic spline.

Given data points, there will be cubic polynomials :

Each of these cubic polynomial must pass through the two points it joins.

At the point and , will pass through both points. At the second point, will also pass trough.

Smoothness conditions is most important in the spline method. Therefore, continuity of the slope and the second derivative , which determines the concavity of the function , must also be agree between the adjacent data points. These conditions controls the oscillations that usually happens in the high order polynomials from happening in Cubic Spline.

*Properties of Cubic Spline:*

- for
*for*. The splines passes through each data points.*for . The spline forms a continuous functions on the interval.**for . The spline forms a smooth function.*

*for . The second derivative is continuous.*

The properties of cubic splines makes sure that Runge phenomenon does not occur in this interpolation method.

Matlab Code:

close all; clc; clear all

%x = linspace(-1,1,15);

x=-cos(pi*(0:20)/20); % the quadrature points [-1,1]

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

xx = linspace(-1,1,100);

yy= 1./(1+25*xx.^2);

y = spline(x,y,xx);

%plot(x,y,’o’,xx,yy)

plot(xx,yy,’b’)

hold on

plot(xx,y,’r’)

The result of this code is the following: