threepoints2planez

バージョン 1.0.0.0 (1.4 KB) 作成者: Chad Greene
Given three points in space, get coefficients of a plane in the form z = slopex*x + slopey*y + C.
ダウンロード: 327
更新 2014/8/13

ライセンスの表示

THREEPOINTS2PLANEZ returns coefficients for an equation of a plane that passes through three points in 3D space. Equation of the plane is in the form

z = slopex*x + slopey*y + C

Example:
Given three random points in x and y, define a z plane having a slope of 2.1 in the x direction and -3.4 in the y direction. Verify that threepoints2planez returns the correct slopes and z intercept:

x = rand(3,1);
y = rand(3,1);
z = 2.1*x - 3.4*y + 19;

[slopex,slopey,C] = threepoints2planez(x,y,z)

slopex =
2.1000

slopey =
-3.4000

C =
19.0000

UPDATE:
After writing this function I found Kevin Moerman's plane_fit function (http://www.mathworks.com/matlabcentral/fileexchange/22042), which uses singular value decomposition to get the same answers. A quick comparison calling plane_fit and threepoints2planez 10,000 times finds that plane_fit is ~20% faster than threepoints2planez (2.9 seconds vs 3.7 seconds). However, threepoints2planez is designed to be more robust (e.g., inputs may be any mix of row or column vectors) and threepoints2planez performs input checks to prevent returning nonphysical numbers. For example, threepoints2planez will return an error message if all three points are collinear, whereas plane_fit will return slope and intercept values even if all inputs are collocated. Choose the function which best suits your needs.

引用

Chad Greene (2024). threepoints2planez (https://www.mathworks.com/matlabcentral/fileexchange/47525-threepoints2planez), MATLAB Central File Exchange. に取得済み.

MATLAB リリースの互換性
作成: R2012b
すべてのリリースと互換性あり
プラットフォームの互換性
Windows macOS Linux
カテゴリ
Help Center および MATLAB AnswersImage Filtering and Enhancement についてさらに検索
タグ タグを追加

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
バージョン 公開済み リリース ノート
1.0.0.0