Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a dataset of trajectories. These trajectories are represented in 3D space (x,y,z). All trajectories of this dataset are similar in their shape, but they are not exactly the same, I mean, there is some variation along the points. The trajectories are nonlinear.

What I need is a kind of regression (polynomial?) on the data to fit the curve along the 3D points, at the end I need a smoothed trajectory, say a generalized one (result of curve fitting/regression).

I just find curve fitting for 2D data (x,y). Can anyone give hints of how to solve it? I heard about local polynomial regression on manifolds, but I dont know how it works, seems to be complex.

thank you in advance

share|cite|improve this question

migrated from Jan 28 '11 at 13:46

This question came from our site for professional and enthusiast programmers.

This is probably off-topic: May I suggest ? :) – Skurmedel Jan 28 '11 at 12:57
I'd even suggest . – Raskolnikov Jan 28 '11 at 13:51
This might generate more answers in – mpiktas Jan 28 '11 at 13:51

It is not clear what you are looking for. One approach to smooth each trajectory is a set of splines. You can just regard each of x, y, and z as functions of time and calculate (for example) a cubic spline. Section 3.3 of Numberical Recipes has a discussion.

If you want to combine the trajectories into one "average" trajectory, you have to decide what you want to do. You could certainly average the x,y,z points of all your trajectories to get an average, then do splines on that. You probably want to average the points an equal distance or time from the origin. Alternately, maybe you have some model of what a trajectory should look like (like an elliptical orbit) and you are trying to remove measurement noise. Then you are in to multidimensional minimization. You write the equation your points are supposed to satisfy (with adjustable parameters) and adjust the parameters until the error is minimized. Chapter 10 of the same book can help.

share|cite|improve this answer
I would point to the link which contains the code in C or Fortran for free. – ja72 Feb 2 '11 at 2:56

Thank you for your hints, I'll check it. Actually I could not attach examples of my dataset, but imagine a set of trajectories in "M" shape. Going through all points of the dataset of trajectories I was intending to fit the data by some kind of regression. But, probably you are right, by using splines perhaps I can do it. The main idea is: given a set of trajectories, to represent this dataset in a single trajectory, a kind of prototype to match in the future with other trajectories to verify if they are similar.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.