Fitting 3D data to a Parabola

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!

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.

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?

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

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)

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

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.

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!

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.