1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Fitting 3D data to a Parabola

  1. Jul 10, 2011 #1
    1. The problem statement, all variables and given/known data

    I'm trying to go about fitting some (x,y,z) coordinate data that I got out of a simulation to a parabola, but I'm not entirely sure how. Is there a general equation for a parabola that instead of having usual (x,y) coordinates has (x,y,z) coordinates?

    2. Relevant equations

    3. The attempt at a solution

    I know how to create a system of equations for fitting (x,y) coordinate data to a parabola and using matrices to solve for the coefficients for the quadratic equation for the parabola that fits those points, but I have no clue on how to apply it to (x,y,z) data.

    I'm thinking that there may be calculus involved?
    Just looking for some insight. Thanks!
  2. jcsd
  3. Jul 11, 2011 #2


    User Avatar
    Homework Helper

    hi lebronlin

    do you want to fit a curve or a surface? you could do both using least squares regression.

    a quadratic surface would be of the form
    [tex]a.x^2+b.y^2+c.z^2+d.xy+g.yz+h.zx +i.x+j.y+k.z+l=0 [/tex]
  4. Jul 11, 2011 #3


    User Avatar
    Homework Helper

    alternatively you could put it in matrix form
    [tex]\textbf{x}^TA\textbf{x}=c [/tex]
  5. Jul 11, 2011 #4
    thanks for the reply, but I would like to fit the data to a curve
  6. Jul 11, 2011 #5


    User Avatar
    Homework Helper

    ok, what is the form of the curve?

    also any other info about the problem may help - if you know anything about specific directions it may make it easier to fit..

    there's a few different way to represent a parabola in 3D, one is as a conic section
  7. Jul 11, 2011 #6
    I'm trying to write code to automatically fit positional data during a specific time frame of orbit for a body to a parabolic curve, so I don't think a conic section could fit my positional data
  8. Jul 11, 2011 #7


    User Avatar
    Homework Helper

    a parabola is a conic section... but i understand they may not be the best tool here

    if its a constant gravity problem, then you know the parabola will be in a vertical plane, I would first regress to find the plane in which all the points lie, then the optimum parabola within that plane

    in fact this may be a good idea even if it is not a constant gravity problem

    the key will be trying to stick to linear regression, as soon as you get into non-linear regression... not 100% but i think this will be the case when you know the orientation of the parabola (eg vertical, horizontal) but may get difficult if you don't know whether it is vertical, horizontal etc.
  9. Jul 11, 2011 #8
    Oops sorry then! Some more specifics about my problem: I'm launching a small body( with initial x,y, and z velocities) towards a much larger body, when the smaller body gets close to the larger body I'm treating its path during its closest encounter as a parabola and trying to fit the points of closest encounter to a parabola so that I may calculate the true minimum distance of encounter. I'm repeating this for many small bodies but with different initial positions and velocities, so I don't think in all situations the points of closest encounter would lie on a single plane, but I may be wrong :p

    The points I'm using to fit to the parabola are the positions before, during, and after the closest encounter in my data. ( 3 points)

    Could you give me a few hints as to how to project my points onto a single plane so that I can fit them to a parabola?

    Last edited: Jul 11, 2011
  10. Jul 11, 2011 #9


    User Avatar
    Homework Helper

    if this is a 2 body problem (preferably a single body problem with infinitesimal test mass), then pick the plane with that contains the test mass, main body and the initial velocity vector. As there are no forces outside that plane, the motion will remain planar, hence why you can fit a parabola which is a planar curve
  11. Jul 11, 2011 #10
    I got home today and was able to pull up some of the data from one trial I generated. Here are three points of the small body (before, at, and after the closest approach that I could see) (I translated its position to be relative to the main body)

    (-0.000461,0.003841, -0.001400)
    (0.000766, -0.002610, -0.001256)
    (0.005331, -0.015542, -0.011193)

    Could you give me an example of the process with these points?

    Thanks for helping me out so much so far! :)
  12. Jul 11, 2011 #11


    User Avatar
    Homework Helper

    ok, so i would first try and fit a plane to the motion, as there are only 3 points you could do this analytically (compute 2 difference vectors and you're pretty much there)


    then do linear regression to find a,b,c,d
  13. Jul 11, 2011 #12
    If its too long of an explanation, do you know where I could find good information about fitting a plane to my points? (I used google but couldn't find many good sources) I'm in high school and my math knowledge goes up to Calc BC, so I don't have much experience in 3-dimensional space
  14. Jul 12, 2011 #13


    User Avatar
    Homework Helper

    do you have lots of points or just 3?

    if its only 3 its quite easy to do and you only really need some vector addition (dot products and cross products would help but not necessary)

    to understand the math behind linear regression you need some reasonable grip on matrix (linear algebra) and multivariate calculus...

    however though its helps to understand the math (and you will have less chance of getting errors), its not required and it is pretty easy to implement in excel with the LINEST function
  15. Jul 12, 2011 #14
    I have a lot of other points, but these three are the only ones that are required to fit the parabola. Thanks for helping me out so far!
  16. Jul 12, 2011 #15


    User Avatar
    Homework Helper

    ok so do you understand what a plane is and how to find the equation of one?
  17. Jul 12, 2011 #16
    I understand what a plane is, but not really how to find the equation of a specific one.

  18. Jul 12, 2011 #17


    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    I don't think three points is enough to determine a parabola even if you know what plane it is in. You need more information to determine its orientation. For example, take an equilateral triangle. You can make a parabola with any of the three vertices of the triangle as its vertex and passing through the other two vertices of the triangle. And I think there are a lot more than three parabolas that can be drawn through the three vertices of the triangle.
  19. Jul 12, 2011 #18

    Ray Vickson

    User Avatar
    Science Advisor
    Homework Helper

    So, if I understand correctly, you have some data (x_i,y_i,z_i), for i = 1,2,...,n and you want to fit a quadratic curve (x,y,z) = (a1,a2,a3) + (b1,b2,b3)*t + (c1,c2,c3)*t^2 to the data. (Here, t is just a parameter that measures where we are on the curve; it is not necessarily time.) Assuming the data do not lie *exactly* on a quadratic curve, you need to specify some measure of goodness of the fit: what makes one fit better than another? A common criterion is a least-squares measure, where we take the sum of the squared deviations and try to minimize that by choosing appropriate values of the ai, bi and ci. However, in your case you need to worry about what a "deviation" actually is. The most natural measure of the deviation of a point (x_i,y_i,z_i) from the curve is the closest distance from that point to the curve, so we need to find the value of 't' that makes the point (x(t),y(t),z(t)) as close as possible to (x_i,y_i,z_i). Equivalently, we can minimize the squared distance, and doing that requires solution of a cubic equation in t with coefficients that involve the ai, bi, ci as well as x_i, y_i, z_i. You need to plug in the solution of the cubic back into the distance^2 formula to determine the contribution of the ith point to the total squared error. Then you need to sum over all i from 1 to n. The result will be a truly horrible function of the ai, bi and ci, which you would like to minimize. Good luck with that.

  20. Jul 12, 2011 #19


    User Avatar
    Homework Helper

    well the simplest way is
    ax + by + cz=d

    each set of points if it lies on the plane must satisfy that equation

    you can further simplify if d is nonzero (may need to check this case... do you expect the plane to pass thorough the origin)
    (a/d)x + (b/d)y + (c/d)z=1
    Ax + By + Cz=1

    if you have 3 points you can write 3 equations, and solve for A,B,C simultaneously

    as mentioned this is a bit easier if you know vectors and matricies
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Similar Discussions: Fitting 3D data to a Parabola
  1. Centroid of a Parabola (Replies: 3)

  2. Centroid of parabola (Replies: 13)