lebronlin said:
Homework Statement
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?
Homework Equations
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.
RGV