# cubic interpolation vs spline interpolation vs cubic spline interpolation?

30 views (last 30 days)
ABTJ on 27 Jun 2020
Commented: ABTJ on 27 Jun 2020
What is difference between these 3 types of interpolation,
cubic interpolation
spline interpolation
cubic spline interpolation(Is it combination of both cubic and spline interpolation)
https://www.mathworks.com/help/matlab/ref/interp1.html Above webpage is link of documentation of matlab interpolation command
But it shows cubic and spline as separate methods As shown highlighted in attached snap
KALYAN ACHARJYA on 27 Jun 2020
cubic spline
https://rb.gy/aamroo

John D'Errico on 27 Jun 2020
Edited: John D'Errico on 27 Jun 2020
pchip is not a true cubic spline, in the sense that it is not a twice differentiable piecewise cubic interpolant. pchip is only a one time differentiable function at the data points. The second derivative is allowed to have a step discontinuity at those points. This is done to allow the function to be shape preserving.
Regardless, there are other ways to perform a piecewise cubic interpolation that would not result in a cubic spline, nor be shape preserving as does pchip. Thus, interp1 offers the 'makima' option, which is another choice to create a different C1 piecewise cubic interpolant. (I believe the idea for that option goes back a long way, to before pchip ever existed. It was just recently introduced in MATLAB however.)
Interp1 offers the option for 'cubic', which currently just uses pchip. Interestingly, I see the note in the doc for interp1 refers to a cubic convolution. I'm not sure what they are talking about, unless this was a spellchecker induced typo. The MathWorks does not really hint well as to their plans for the 'cubic' option, since the comment is a bit cryptic.
And, yes, when the word spline is used, we could technically have splines of other orders than a cubic spline. That is not the case for interp1. In interp1, when it says spline, this refers to a cubic spline. Thus a twice differentiable piecewise polynomial function, composed of cubic segments. The not-a-knot end conditions are chosen, which indicates a specific set of end conditions to create a thrice differentiable cubic across the second and penultimate breaks of the spline. So those two break points become effectively not break points at all.
Anyway, currently 'cubic' and 'spline' are indeed different in interp1, as the first is currently used as a call to pchip. However, 'spline' in interp1 is always a reference to a cubic spline.
ABTJ on 27 Jun 2020
What is meant by continuty types C0,C1 and C2??

R2015b

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by