Path: news.mathworks.com!not-for-mail
From: "Bruno Luong" <b.luong@fogale.fr>
Newsgroups: comp.soft-sys.matlab
Subject: Re: polyfit in 3D
Date: Sun, 4 May 2008 19:26:03 +0000 (UTC)
Organization: FOGALE nanotech
Lines: 17
Message-ID: <fvl2ka$nks$1@fred.mathworks.com>
References: <fvl1q3$8sv$1@fred.mathworks.com>
Reply-To: "Bruno Luong" <b.luong@fogale.fr>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1209929163 24220 172.30.248.37 (4 May 2008 19:26:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 4 May 2008 19:26:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 390839
Xref: news.mathworks.com comp.soft-sys.matlab:466550


"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 ?
> 

[X(:) Y(:) ones(numel(z),1)] \ Z(:)

provides you (a,b,c) of the fitted plane z=ax+by+c

Bruno