How do I do a cubic spline interpolation?
@hartnn Are you familiar with this?
nopes, sorry.
@phi Are you familiar with this?
yes, but I would have to google it to remember the details.
Really?! I have an exam tomorrow on numerical methods, and that is the only thing I don't know how to do. If you could help me at all it would be very appreciated!
what technique are you learning ?
I'm not sure what you mean, but this is what is says about it in my text book. The objective in cubic splines is to derive a third-order polynomial for each interval between knots, as in fi (x) = ai x3 + bi x2 + ci x + di Thus, for n + 1 data points (i = 0, 1, 2, . . . , n), there are n intervals and, consequently, 4n unknown constants to evaluate. Just as for quadratic splines, 4n conditions are required to evaluate the unknowns. These are: 1. The function values must be equal at the interior knots (2n − 2 conditions). 2. The first and last functions must pass through the end points (2 conditions). 18.6 SPLINE INTERPOLATION 515 3. The first derivatives at the interior knots must be equal (n − 1 conditions). 4. The second derivatives at the interior knots must be equal (n − 1 conditions). 5. The second derivatives at the end knots are zero (2 conditions). The visual interpretation of condition 5 is that the function becomes a straight line at the end knots. Specification of such an end condition leads to what is termed a “natural” spline. It is given this name because the drafting spline naturally behaves in this fashion (Fig. 18.15). If the value of the second derivative at the end knots is nonzero (that is, there is some curvature), this information can be used alternatively to supply the two final conditions. The above five types of conditions provide the total of 4n equations required to solve for the 4n coefficients. Whereas it is certainly possible to develop cubic splines in this fashion, we will present an alternative technique that requires the solution of only n − 1 equations. Although the derivation of this method (Box 18.3) is somewhat less straightforward than that for quadratic splines, the gain in efficiency is well worth the effort.
it says ***Whereas it is certainly possible to develop cubic splines in this fashion, we will present an alternative technique*** in other words, there are different algorithms.
If this is a course, they may want you to know the details of how a cubic spline is developed, as opposed to using it (which involves calculation based on a cookbook procedure).
Or they may want you to know the what distinguishes a cubic spline interpolation from quadratic splines.
Well, in my class notes, it says: " Your text book has sections on linear and quadratic splines (read these if you want more background), but we will go to cubic splines. So I think he just wants us to be able to do a question.
Join our real-time social learning platform and learn together with your friends!