0
$\begingroup$

Is there a way to fit a 2D curve under the following conditions:

  1. The curve is defined by 2 functions for x>a, and x<a
  2. Prefer a fit that is continuous and differentiable at x=a
$\endgroup$
1
  • $\begingroup$ In the benefint of a more concrete discussion can you provide an example of numerical data. Or alternatively can you give an example of 2 functions that you commonly enconter in your fitting calculus. $\endgroup$
    – JJacquelin
    Apr 29 '21 at 15:30
5
$\begingroup$

I hope I understood you correctly and that the following thoughts help you a bit.

Reference point: Univariate curve fitting using splines

With a univariate function $f(x)$ you can perform 1D spline interpolation and require for each (inner) $x_i$-node that: $$ \begin{align} \left.f_{i-1}(x)\right|_{x=x_i}&=\left.f_i(x)\right|_{x=x_i} \quad \mathrm{continuity}\\ \left.\frac{\partial ^k f_{i-1}(x)}{\partial x^k}\right|_{x=x_i}&=\left.\frac{\partial ^k f_{i}(x)}{\partial x^k}\right|_{x=x_i} \quad k\mathrm{th \ order \ differentiability}\\ \end{align} $$

And the $K$th order 1D-spline function is identified by

$$f_i(x)=\sum_{j=0}^K\beta_{i,j}x^j \quad \mathrm{for} \quad x_i\leq x<x_{i+1} $$

For an $K-1$th-order spline you get $K$ degrees of freedom per function. Say you have a total of $N$ test points $\{x_i,y_i\}_{i=0\ldots{N-1}}$. This nets you a total of $N-1$ functions to fit and hence $K\times(N-1)$ parameters. Say you select a cubic spline ($K=3$, four degrees of freedom per function), then you could, for example, produce a spline such that $$ \begin{align} \beta_{i-1,0}+\beta_{i-1,1}x_i+\beta_{i-1,2}x_i^2+\beta_{i-1,3}x_i^3&=\beta_{i,0}+\beta_{i,1}x_i+\beta_{i,2}x_i^2+\beta_{i,3}x_i^3 \quad \mathrm{equality}\\ \beta_{i-1,1}+2\beta_{i-1,2}x_i+3\beta_{i-1,3}x_i^2&=\beta_{i,1}+2\beta_{i,2}x_i+3\beta_{i,3}x_i^2 \quad \mathrm{f'}\\ 2\beta_{i-1,2}+6\beta_{i-1,3}x_i&=2\beta_{i,2}+6\beta_{i,3}x_i \quad \mathrm{f''}\\ \beta_{i-1,3}&=\beta_{i,3} \quad \mathrm{f'''} \end{align} $$ holds at all (inner) nodes. In total, you have thus identified $N + 3(N-2)$ of your parameters. Adding an assumption on the behavior of $f_0‘(x_0)$ and $f_{N-1}^‘(x_{N-1})$ usually yields the remaining parameters.

Your case: Bivariate extension

In the bivariate spline case, each point is now bounde by a surface segment (surrounded by 4 test points):

$$ \begin{align} x_{i-1}\leq x < x_i, y_{j-1}\leq y < y_j \end{align} $$ and the spline function is now commonly given by:

$$ f_{i,j}(x,y)=\sum_{k=0}^K\sum_{l=0}^K\beta_{i,j,k,l}x^ky^l $$

As you can see, a $K$th order 2D-spline requires (canonically) $(K+1)^2$ parameters per segment. Hence, we need more test points to enter the spline function, and we have a quadratic increase in conditions (continuity, differentiability...). This may be a good starting point for your endeavour.

$\endgroup$

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.