# Interpolating experimental data correctly (limited model knowledge)

I have data which I know follows a function $y = f(x)$ such that it is quadratic i.e. $y =\alpha x^2$ for some $\alpha$ when $x\rightarrow 0$ and $y = \beta x$ for large $x$.

The data itself has errors too since it is from a real experiment.

What method should I use to find the best fit curve that satisfies the model constraints (quadratic at low x, linear at large x, anything goes for intermediate x) and fits the data as best as possible?

I'm not really even sure where to begin since standard interpolation techniques in MATLAB seem to try and fit every data point. I'm also not sure how to enforce the model constraints. Thanks!

• This question would probably be better suited to cross validated. – lemon Apr 5 '16 at 9:54

## 2 Answers

Well the first step would be to plot $f(x)/x$. From this you should be able to identify two regions of linearity to which you can apply linear regression to find the $\alpha$ and $\beta$ constants: Without knowing the relevant physics or seeing the data, it's difficult to say what the best approach for handling the 'intermediate' region would be. If the data is sufficiently smooth (or if you don't care about the intermediate region too much) then you could guess a functional form with the correct limiting behaviour. Another option is to construct $f$ to be piecewise and fit a spline to the intermediate region.

What method should I use to find the best fit curve that satisfies the model constraints (quadratic at low x, linear at large x, anything goes for intermediate x) and fits the data as best as possible?

It depends on what your goal exactly is, whether you want to find $\alpha,\beta$ as accurately as possible or whether you want "good fit" in the sense that the curve passes as close as possible to the points measured. It also depends on how much do you know about error of $x$ and $y$ values.

The simplest thing that would satisfy your requirements would be to introduce a parametrized function of $x$ (with parameters being $\alpha, \beta$ and possibly others as well) that would obey mentioned asymptotic behaviours and find the parameters of the function with the least-squares method.

https://en.wikipedia.org/wiki/Least_squares

You may, for example, assume there are three measurement-characterizing values of $x$:

• $\lambda_\alpha$, beyond which quadratic term becomes non-dominant;
• $\lambda_\beta$, beyond which linear term becomes dominant;
• $w_\beta$, interval of $x$ where linear term gains weight.

Then you can use a function like

$$f(x) = \alpha x^2 e^{-x/\lambda_\alpha}+ \beta x \frac{1}{1+e^{-(x/w_\beta-\lambda_\beta/x)}}$$

and fit all parameters with least-squares method.

• The things is, it's experimental data (that's missing error bars unfortunately but presumably they're there) so I guess the objective is getting the points to pass as close as possible and getting the right asymptotic behaviour from the fitted curve. I will try this, seems like a good idea! – user1936752 Apr 7 '16 at 5:45