I am working on cubic spline interpolation with set of data points from CAD with following steps:
- Form piecewise spline equations between points. cubic equation :
$ ax^3 + bx^2 +cx + d = P(x) $ - Form first derivative equations at interior points
- Form Second derivative equations at interior points
- Set Second derivative equations at exterior points to zero
Attached is the workout on spreadsheet with formulas and the calculations as follows,
Google spreadsheet with interpolation calculation
- Section1: Contains input data points for interpolation
- Section 2: spline equations in matrix form
- Section 3: Interpolation results for test points
- Section 4: Graphical representation of spline (Points marked in
Green are input data points and marked in Red are test points used
to test in section 3)
Query:
But interpolation result for the test points in section 3 yields loss of precision of around 1 to 2 mm. Am I making mistakes in procedures or calculation? or do the interpolation always results in loss of precision?
If someone could throw light on this, would be appreciated.
Best Answer
Cubic spline interpolation thru points will pass thru the given points exactly (subject to numeric errors though). But in general it will have deviation when compared against the original curve (from which you sample the points) except at those interpolated points. The fact that you are having a 0.1% deviation suggests that the cubic spline you found is a very good approximation to the original curve.
In fact, if you use the interpolated points (instead of the test points) in step 3, you should still find "loss of precision" while the difference should be theoretically zero. Such "loss of precision" comes from doing the numeric solving of the linear equation set. Such numeric errors could become notably large when your matrix value is extremely big (or small), such as in your case.