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
$\endgroup$
  • $\begingroup$ Best way in what sense? There are different methods and each has its own dis/advantages. $\endgroup$ – Gigili Aug 1 '12 at 8:51
  • $\begingroup$ 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. $\endgroup$ – davivid Aug 1 '12 at 9:03
3
$\begingroup$

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.

$\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.