I am trying to calculate an integral using spline interpolation with matlab (version R2014a on windows 8).
I have the 3 values of the function (for x=0,0.5,1).
so I have 2 vectors - x and y that contain the values of the function, and I'm executing
cube_spline = spline(x,y);
coefficients = qube_spline.coefs
And I'm expecting to get 2 polynomials, each of degree 3, i.e I'm expecting coefficients to be a matrix of size 2*4, but somewhy I'm getting a matrix that is 1*4, which means only 1 polynomial for 2 panels.
On the other hand, if for example I'm using 4 dots, (i.e 3 panels) then I'm getting that coefficients's size is 3*4 as expected, which means 3 polynomials for 3 panels.
My question is Why does matlab return only 1 polynomial for 2 panels spline, and 3 polynomial for 3 panels spline (or any number that is greater then 2)?
splineis cubic spline interpolation, i.e. degree 3. I guess it's a typo that you expect a degree 4 polynomial (which would have 5 coefficients). - knedlseppsplinewill chose one of those infinitely many curves by using some extra internal condition, like minimizing the second derivative or vanishing boundary conditions or something similar. Expecting two polynomials from three data points is just too much, as it can already be described by a single polynomial. - knedlsepp