Interpolating a given data by a "simple" function

44 Views Asked by At

I'm working on the fluid dynamics field and I need your help for this problem.

I'm looking for a "simple" function ($\log,\exp$ and Polynomials) to interpolate the function given by the following data

Representation of the function

I tried many simple functions in vain.

2

There are 2 best solutions below

0
On

If you have access to Excel, try using the "Trend Line" function. Documentation is here. From your data, I would guess that a polynomial of degree 4 or 5 would work OK.

0
On

EDIT: I prepared a short example with your data and a little tool I wrote some time ago. In it you can see several hypothesis for the basis functions fitted using Bayesian updates and compared with Bayesian model selection (instead of minimising the empirical risk, one postulates a prior over the weights and updates it with every new data point coming in, then the different models are compared and the one which "explains best the data" in some sense is taken).


You may want to try linear regression with basis functions.

Basically, you start with some fixed set of basis functions $\phi_i$ (for instance $\phi_i(x) = x^i$) and find coefficients $\alpha_i \in \mathbb{R}$, such that the function $\hat{f} = \sum_i \alpha_i \phi_i$ approximates your unknown function $f$ in some sense.

Since you don't know what $f$ is, this is done by minimising the empirical risk, which could typically be given by $R(\hat{f}) = \sum_i |f(x_k) - \hat{f}(x_k)|^2$.

There are many software packages able to do this automatically for you (e.g. in R or in Python), and even compare different models among each other (e.g. with Bayesian model selection or Akaike information criterion or whatnot). The last bit is actually the tricky part: given $n$ points in $\mathbb{R}$ there is always a polynomial of degree $n-1$ interpolating them, but you definitely don't want that one (you'd be overfitting and your $\hat{f}$ would be a very bad interpolator)), so you need some principled way of picking the right function space $\{\phi_i\}$.

A bit of googling will get you going real fast.