I'm currently trying to create a natural cubic spline by setting up linear equations to solve for the coefficients of the spline.
Where the spline follows as :
$S_i(x)=a_i+b_i(x-x_i)+c_i(x-x_i)^2+d_i(x-x_i)^3$ where $i=0,...n-1.$
I need to construct the spline to fit the following data points :
$ x = 3, 5,9, 13, 21$ and $y= 625, 410, 299, 130, 82$
As you can see, the X values is unequally spaced.
Where the equal spacing is used within the tridiagonal system.
What alteration can I use to create a cubic spline?