This method provides a great deal of smoothness for interpolations with significantly varying data. It uses weight
coefficients on the cubic polynomials to interpolate the data. These coefficients bend the line so that it passes through each
of the data points without any erratic behavior or breaks in continuity.
Algorithm Creation
The basic idea of the cubic spline is actually based on a third degree polynomial defined by,
si(x) = ai(x - xi)3 + (x - xi)2 + ... for i=1,2,...n-1
|
Testing the Cubic Spline Method
In order to test the Spline method as defined above, a new TestSpline()
static method has been added and executed. Supporting code and methods are not shown.
static void TestSpline();
{
ListBox1.Items.Clear();
ListBox2.Items.Clear();
double[] xarray = new double[] { t1, t2, t3, t4, t5 };
double[] yarray = new double[] { t6, t7, t8, t9, t10 };
double[] x = new double[] { t11, t12, t13 };
double[] y = Interpolation.Spline(xarray, yarray, x);
VectorR vx = new VectorR(x);
VectorR vy = new VectorR(y);
ListBox1.Items.Add(" " + vx.ToString());
ListBox2.Items.Add(" " + vy.ToString());
}
|