2
$\begingroup$

Let be given a set of measurements $\left\{(x_1,y_1), (x_2,y_2),\ldots, (x_n,y_n)\right\}$. For these points, we further are given the slopes $y'_i$ measured at the support points $x_i$ for $i \in \{1,\ldots,n\}$.

I am looking for a common interpolation method that can incorporate this information efficiently. What I need is an interpolation function $y=f(x)$ with values $y_i$ and first derivatives $y'_i$ at the support points $x_i$.

I first checked for cubic splines, but these just assure that the splines have the same first and second order derivative at the support points (knots). Prescribing the actual slope (for all knots) is not foreseen.

Hints on existing implementations in Python, Matlab, C++, ... would be highly appreciated too.

$\endgroup$

1 Answer 1

3
$\begingroup$

Cubic Hermite spline will interpolate given set of points and first derivatives. This should be what you need. See here for details.

$\endgroup$
5
  • $\begingroup$ Thanks, this was of help. You can find here sample code of mine in python that demonstrates how this can be achieved with scipy.interpolate.BPoly.from_derivatives. $\endgroup$
    – normanius
    Commented Dec 29, 2017 at 18:28
  • 1
    $\begingroup$ @normanius. Your question here was about an interpolation scheme that produces a real-valued function, of the form $y=f(x)$. Your code does interpolation in 2D, so it produces a function $\mathbf{X} = \mathbf{X}(t)$ with values in $\mathbb{R}^2$. These are somewhat different problems, because the second one involves a somewhat arbitrary choice of parameterization. You chose chordal parameter values, but there are several other choices that work just as well, if not better. $\endgroup$
    – bubba
    Commented Dec 31, 2017 at 4:19
  • $\begingroup$ @bubba. Thanks for checking out. You're right, I solved a slightly different problem in the implementation, but it still demonstrates how BPoly.from_derivatives can be used to compute cubic Hermite splines. The code computes multiple interpolation curves $x_d(t)$ ($d=1,2$ and $\mathbf{X}=(x_1, x_2)$ in my 2D example) with knots at $t_i$ and $x_d(t_i)=x_{d,i}$ and $x'(t_i)=x'_{d,i}$. This resembles the original problem posted here. But you're right in that I do more than just this. $\endgroup$
    – normanius
    Commented Dec 31, 2017 at 6:40
  • $\begingroup$ @bubba. Do you know alternatives for that approach using chordal parametrization? I found uniform and centripetal. Or can you think of a way to circumvent parametrization at all? $\endgroup$
    – normanius
    Commented Dec 31, 2017 at 6:43
  • $\begingroup$ @normanius -- those three are the most common ones. But, in fact, you can use any increasing sequence of numbers. AFAIK, the only way to avoid choosing parameter values is to include them as unknowns in the interpolation problem. But then the problem becomes horribly non-linear. $\endgroup$
    – bubba
    Commented Dec 31, 2017 at 13:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .