FIT A PLANE THROUGH DATA POINTS

Engineering Fundamentals

INTRODUCTION

Method to derive a best fit a plane through number (≥ 3) XYZ data points, where the summed square errors of the data pointsin relation to the fit-plane in Z-direction is minimal.

Was this helpful? Please share this with your colleagues and friends:

Share
Equation of a plane

z(x,y) = A\ {\cdot}\ x + B\ {\cdot}\ y + C

Data points

\left[\begin{matrix}x_1&y_1&z_1\\x_2&y_2&z_2\\x_3&y_3&z_3\\{\Box}&{\vdots}&{\Box}\\x_n&y_n&z_n\end{matrix}\right]

Coefficients of plane equation

\left[\begin{matrix}A\\B\\C\end{matrix}\right]=\left[\begin{matrix}\sum _{i=1}^nx_i^2&\sum _{i=1}^nx_iy_i&\sum _{i=1}^nx_i\\\sum _{i=1}^nx_iy_i&\sum _{i=1}^ny_i^2&\sum _{i=1}^ny_i\\\sum _{i=1}^nx_i&\sum _{i=1}^ny_i&\sum _{i=1}^n1\end{matrix}\right]^{-1}{\cdot}\ \left[\begin{matrix}\sum _{i=1}^nx_iz_i\\\sum _{i=1}^ny_iz_i\\\sum _{i=1}^nz_i\end{matrix}\right]

Tip / Tilt angles

Rx = atan\left[\frac {d}{dy}z(x,y)\right] = atan[B]
Ry = atan\left[-\frac{d}{dx}z(x,y)\right] = atan[-A]

Fit quality – Coefficient of determination = R2

R^2 = 1-\frac{\sum _{i=1}^{i=n}\left (z_i-z(x_i,y_i)\right)^2}{\sum _{i=1}^{i=n}\left(z_i-\frac {1}{n}\sum _{i=1}^nz_i\right)^2}

A value of R^2 which is close to 1 indicates a good fit quality.

Fit plane through data points

This page uses QuickLaTeX to display formulas.