1
$\begingroup$

With the following data set, what is the best way to interpolate the data for each time.

Time    X    Y 0      10    15 ... ... 24     28    17 ... ... 49     9     14 
  • 0
    Now I think about it more, I guess just a linear straight line fit is best for my usage. As I know my objects position at 0 and at 24, and need to estimate as close as possible where it is at any other time. in this instance it is a cube structure rotating slightly off-axis.2012-08-01

1 Answers 1

3

You can use Newton's divided differences interpolation polynomial which is easy to use and if you add a new point to the set, you don't have to calculate everything again.

So you'll have a table with four columns, $x_i, y_i$ and divided differences where:

$f\left[x_0,x_1,\dots, x_n\right]=\dfrac{f\left[x_0,x_1,\dots, x_{n-1}\right]-f\left[x_1,\dots, x_n\right]}{x_0-x_n}$

Then, for example, you have:

$x_0=10, y_0=15, x_1=28,y_1=17$: $f[x_0,x_1]=\dfrac{y_0-y_1}{x_0-x_1}=\dfrac{15-17}{10-28}=0.11$

$f[x_1,x_2]=\dfrac{17-14}{28-9}=0.15$

$f[x_0,x_1,x_2]=\dfrac{0.11-0.15}{10-9}$

Thus, the interpolating polynomial is:

$p(x)=f_0+(x-x_0)f[x+0,x_1]+\dots+(x-x)\dots(x-x_{n-1})f[x+0,\dots,x_n]$

And it's easy to take it from here.