Regression Plane / Fit Plane

markraz

Full Member
Joined
Feb 19, 2014
Messages
338
Hi I have a bunch of 3d points, I need to fit them to a plane like this
1574882999759.png

What techniques does someone use to accomplish this? I looked in my algebra books but there were no examples. All the examples on the internet are using computer code. I was wondering how this can be done by hand with paper and pencil?? I know I ultimately need to find the normal vector in of a b c from plane equation ax+ by + cz +e = 0
Thanks
 
Last edited:
Such a plane can be written z= Ax+ By+ C so you need to find A, B, and C for the plane that most closely. One measure of "distance" from such a plane is the difference in z values for the given x and y of the point. That is, for a given point, \(\displaystyle (x_i, y_i, z_i)\) you want to look at \(\displaystyle |z_i- Ax_i- By_i- C|\). The "regression plane" minimizes the "least squares error" so you want to determine A so that \(\displaystyle \sum_{i=1}^n (z_i- Ax_i- By_i- C)^2\). That can be done by setting the partial derivatives, with respect to A and B, equal to 0.

You want to find A and B such that \(\displaystyle \sum_{i=0}^n x_i(z_i- Ax_i- By_i- C)= 0\), \(\displaystyle \sum_{i=0}^n y_i(z_i- Ax_i- By_i)= 0\) and \(\displaystyle \sum_{i=0}^n -(z_i- Ax_i- By_i- C)= 0\). Solve those three equations for A. B, and C.

(I am assuming you are given the x, y, z coordinates for all of the points.)
 
You want to find A and B such that \(\displaystyle \sum_{i=0}^n x_i(z_i- Ax_i- By_i- C)= 0\), \(\displaystyle \sum_{i=0}^n y_i(z_i- Ax_i- By_i)= 0\) and \(\displaystyle \sum_{i=0}^n -(z_i- Ax_i- By_i- C)= 0\). Solve those three equations for A. B, and C.

(I am assuming you are given the x, y, z coordinates for all of the points.)

Thanks Hallofivy, I do have many xyz points. So for each xyz I need to sum each dimension and then calculate the partial derivative?
or do solve the partial derivative for each set of points first?

thanks
 
Top