2

All packages I find to fit a polynomial are for one dimensional data. By that I mean the dependent variable is one dimensional. I have points with two dimensions on a plane. I know the order in time and I want to fit a cirve through it. It should be reasonably smooth. My intuition says it is a parametric curve of time but how to fit it ? perhaps some kind of spline or polynomial fit on plane? Equations of motion of a particle ?

alireza
  • 1,251
  • Since you know it should be on a plane, you could start by fitting the points to the plane with linear algebra, just a least squares solution for example. Then switch basis to the plane and assume for example a 2D polynomial. – mathreadler Jul 30 '17 at 16:11
  • I know it is on the plane. – alireza Jul 30 '17 at 16:24
  • If you want to you can just assume 2 polynomials in $t$ once you have changed basis to the plane: one for $x$ and one for $y$ ( in the new coordinate system ). Since $t$ is not an unknown for you, but the coefficients are, it turns into just another nice linear least squares problem. – mathreadler Jul 30 '17 at 16:29
  • but my points are ordered in time. How do I guarantee that that patametrized fit does not get close to one in the future before getting close to one in the last. I.e. Changes time order? – alireza Jul 30 '17 at 17:03
  • As i wrote in the last comment, you can make 2 polynomials of the variable $t$, one for each dimension in the plane. – mathreadler Jul 30 '17 at 17:21
  • but you see suppose the path turns around in the future and gets close to itself then how do I assure the fit does not change the order and get close to a future point before a past point ? You see what I mean ? – alireza Jul 30 '17 at 17:26
  • I don't see what you mean, it becomes a linear least squares problem, maybe you want to apply some Tikhonov regularization if that is what you are jabbing at. – mathreadler Jul 30 '17 at 17:28
  • It is easy to test, generate some trajectories according to some randomized polynomials you sample and then you try to solve for it and then compare the result to the randomized "ground truth". – mathreadler Jul 30 '17 at 17:34

1 Answers1

1

One possible solution would be a parametric spline curve. This is a curve $\mathbf{S}(t) = \bigl(x(t),y(t)\bigr)$, where $t$ is some parameter, which in your case can be time.

These sorts of splines can be made to interpolate given data points at specified parameter values. In other words, given points $\mathbf{Q}_i$ and parameter values $t_i$, we can construct the curve $\mathbf{S}$ so that $\mathbf{S}(t_i) = \mathbf{Q}_i$ for all $i$.

Some further info and a reference in my answer to this question.

Also, my answer to this question.

bubba
  • 44,617