Path: news.mathworks.com!not-for-mail
From: "Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid>
Newsgroups: comp.soft-sys.matlab
Subject: Re: polyfit in 3D
Date: Thu, 8 May 2008 23:07:03 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 26
Message-ID: <g0012n$lob$1@fred.mathworks.com>
References: <fvl1q3$8sv$1@fred.mathworks.com>
Reply-To: "Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1210288023 22283 172.30.248.38 (8 May 2008 23:07:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 8 May 2008 23:07:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:467512


"Nicolas Guillemette" <nico_guillemette@hotmail.com> wrote in message 
<fvl1q3$8sv$1@fred.mathworks.com>...
> 
> I'm looking for a function that finds the coefficients of a 
> polynomial of degree n that fits the data of a three 
> dimensional set of variables. I have X, Y and Z vectors and 
> I want to fit a plan (not a curve)on XY plan ?
> 
> How can I proceed ?
> Thx
> Nicolas Guillemette
------------
  It isn't clear what you are asking, Nicolas.  It doesn't require a polynomial of 
degree higher than 1 to define a plane, which is what you seem to be asking 
for.  With only degree 2 in x, y, and z, you would be in the realm of ellipsoids, 
hyperboloids, paraboloids, and the like.

  Also you haven't told us what you regard as your criterion for best fit here.  
In the case of a plane you might want to minimize the mean square deviation 
of the points' z coordinates from that of the plane, or you might want to 
minimize their mean square orthogonal distances from the plane.  Matlab 
provides methods for solving either kind of problem.  Similar questions apply 
to higher degree polynomial surfaces.

Roger Stafford