I need to use cubic splines to interpolate between data points (sets of x-y-coordinate pairs). The problem is that there is the well-known "overhooting" of the spline that occurs every now and then (for example at 0.4 in the following image).

Overshooting in cubic spline

This behaviour is not desired for further processing of the spline, so I am searching for a way to get rid of these overshots. However, I need to be sure that the adjusted/processed spline will still be continuous up to the second derivative because it will be used to calculate a machine-toolpath which has constraints for its maximum velocity, acceleration and jerk.

So I looked around and found not really much except for this article and this Paper, to which I unfortunately have no access.

Has anyone used the above mentioned method to avoid overhooting of a spline? As far as I understand I have to manually readjust the slope for each data point. Do these adjustments somehow "break" the continuity of the cubic spline (or its derivatives)?

The linked article does not specifically cover this topic. Maybe because it is obvious and I do not understand it completely.


The "standard" cubic spline is $C_2$ -- it has continuous second derivatives at its joins. In fact, we construct the spline by computing first derivative values that will make the spline $C_2$ (or, that's one way to construct it, anyway). Assuming we have already chosen some end conditions, the computation is just solution of a linear system to find the first derivatives. This linear system has a unique solution, so the $C_2$ cubic spline is unique.

So, if we produce first derivative values using some other technique (like the ones used to force monotonicity), the resulting curve will not be $C_2$.

If you could also fabricate second derivative values at the joins, then you could build a quintic (degree 5) segment in between each pair of points, and this would be $C_2$. The Wikipedia page you cited mentions this.

If you're worried about machine tool dyanamics, you might need better than $C_2$. See here for more info.

And $C_2$ might not be the right condition, anyway; maybe the issue is continuity of curvature, not continuity of second derivatives. In other words, $G_2$, rather than $C_2$.

  • 1
    $\begingroup$ But following this notation, wouldn't we just use a different constraint in eq. (11) by manually definig a fixed slope at the data points? So we would get Y'_[i-1](1) = Y'_[i](0) = "some fancy slope that ensures monotonicity" ? $\endgroup$ – Olbert Dämmerer Dec 19 '17 at 14:09
  • 1
    $\begingroup$ Yes, but that's a different equation from the one that ensures $C_2$ continuity. There is only one set of first derivative values that give us a $C_2$ curve. If you use different first derivative values, the resulting curve will not be the $C_2$ one. $\endgroup$ – bubba Dec 20 '17 at 2:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.