0

This is a question at the crossroads of mathematics and programming.

I have a sequence of values that are generated every $300$ms. (Not exactly, but I know the exact time point of each value). I am sending a sequence of values at the same rate, which each being the result of the application of a known function to each of these values. This poses no problem.

Now, I'd like to send values at a more frequent rate. (like every $50$ms) I would like to extrapolate the values to send according to the last (e.g. $4$) real values to send. (i.e. the results of the application of the function to the received values).

For this, I am imagining a solution where I generate a polynomial/exponential/something-al function that goes through the $4$ last points, and then I generate extra values to send, thanks to this function, until I get another real value to send, at which point I will regenerate the function with the last $4$ points, and so on.

Given $4$ points, how may I generate this function? I am looking for a function on time, not a parametric function.

sirfoga
  • 4,336
  • The best way to do this depends a lot on what your values represent and how they are distributed, and also what you hope to do with the more-frequently-sent values. You are basically trying to predict the future - there's no single equation that can do this effectively; you need to know something about the physical system. – ajd May 09 '14 at 14:11
  • My input values (the $300$ms input) are the pitch angle of a flying airplane. The values are continuous, and represent the positions of a physical solid moving with low jerk. – Laurent LA RIZZA May 09 '14 at 14:25

1 Answers1

1

You could use Lagrange interpolation.

Apply the given formulae with $k=3$; you will be fitting the previous 4 points with a cubic polynomial.

I think there is a problem with your basic idea, though. When you get a new point, you will recompute the interpolant. And the new interpolant won't join smoothly with the previous one unless you do something to force this.

bubba
  • 43,483
  • 3
  • 61
  • 122
  • Thank you for the pointer, I'll look into it. I'm not looking for a perfect solution, but just something that brings me closer to the truth than just one value every $300$ms. The interpolant may not join smoothly with the previous one, but I guess that's the case anyway when you try to predict the future. Once I get the new real value to compute the next interpolant, the harm has already been done. – Laurent LA RIZZA May 09 '14 at 15:51
  • Why did you pick 4 points? Why not 3 or 5? – bubba May 10 '14 at 02:46
  • I does not matter. I know how to linearly extrapolate from 2 points, (And it's probably sufficient), but cubic interpolation seemed to be a good idea. Quadratic may be sufficient. I was looking for some general formula. So no real reason actually. – Laurent LA RIZZA May 10 '14 at 08:58