http://www.mathworks.com/matlabcentral/newsreader/view_thread/282704
MATLAB Central Newsreader  Fitting a plane
Feed for thread: Fitting a plane
enus
©19942014 by MathWorks, Inc.
webmaster@mathworks.com
MATLAB Central Newsreader
http://blogs.law.harvard.edu/tech/rss
60
MathWorks
http://www.mathworks.com/images/membrane_icon.gif

Thu, 20 May 2010 18:38:04 +0000
Fitting a plane
http://www.mathworks.com/matlabcentral/newsreader/view_thread/282704#747253
Rachit
Hello All,<br>
<br>
I am trying to fit a plane using a set of (X,Y, Z ) coordinates.I am relatively new to matlab can anyone suggest me how to go ahead with the same?

Thu, 20 May 2010 19:03:04 +0000
Re: Fitting a plane
http://www.mathworks.com/matlabcentral/newsreader/view_thread/282704#747268
Matt J
See this thread<br>
<br>
<a href="http://www.mathworks.com/matlabcentral/newsreader/view_thread/263635#688424">http://www.mathworks.com/matlabcentral/newsreader/view_thread/263635#688424</a>

Thu, 20 May 2010 19:04:04 +0000
Re: Fitting a plane
http://www.mathworks.com/matlabcentral/newsreader/view_thread/282704#747270
Roger Stafford
"Rachit " <racpsine@gmail.com> wrote in message <ht3vic$134$1@fred.mathworks.com>...<br>
> Hello All,<br>
> <br>
> I am trying to fit a plane using a set of (X,Y, Z ) coordinates.I am relatively new to matlab can anyone suggest me how to go ahead with the same?<br>
       <br>
If you want to minimize the sum of the squares of the orthogonal distances from the points to a plane, then you can use the 'svd' function. Let us suppose that X, Y, and Z are corresponding column vectors.<br>
<br>
xm = mean(X); ym = mean(Y); zm = mean(Z); <br>
[U,S,V] = svd([Xxm,Yym,Zzm],0);<br>
<br>
Then the bestfitting plane in the above sense is given by the equation<br>
<br>
V(1,3)*(xxm) + V(2,3)*(yym) + V(3,3)*(zzm) = 0<br>
<br>
The indicated V(:,3) is the eigenvector corresponding to the smallest singular value in S and represents the best fit.<br>
<br>
Roger Stafford

Thu, 20 May 2010 19:09:04 +0000
Re: Fitting a plane
http://www.mathworks.com/matlabcentral/newsreader/view_thread/282704#747274
Walter Roberson
"Rachit " <racpsine@gmail.com> wrote in message <ht3vic$134$1@fred.mathworks.com>...<br>
<br>
> I am trying to fit a plane using a set of (X,Y, Z ) coordinates.I am relatively new to matlab can anyone suggest me how to go ahead with the same?<br>
<br>
I am not certain that there will usually be a unique solution, but it will depend what you mean.<br>
<br>
What properties do you expect the fitted plane to have? For example, imagine that I supply coordinates for points lying in two planar squares of the same size and X Y positions, with those two planes parallel to each other in Z: then were would you want the fitted plane to lie? Halfway between the two squares and parallel to them? Diagonally through the corners of the two squares so as to maximize the number of points in each of the squares that is passed through? In the same plane as one of the squares so as to maximize the total number of original points passed through?