Path: news.mathworks.com!not-for-mail
From: "John D'Errico" <woodchips@rochester.rr.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: linear regression
Date: Sun, 18 May 2008 11:23:01 +0000 (UTC)
Organization: John D'Errico (1-3LEW5R)
Lines: 36
Message-ID: <g0p3il$55m$1@fred.mathworks.com>
References: <13a0ad36-75d8-4ca0-b585-727d3a8ce1a9@w8g2000prd.googlegroups.com>  <f4a869df-f422-47d9-bda7-1daafa173bb1@z16g2000prn.googlegroups.com>
Reply-To: "John D'Errico" <woodchips@rochester.rr.com>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1211109781 5302 172.30.248.35 (18 May 2008 11:23:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 18 May 2008 11:23:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 869215
Xref: news.mathworks.com comp.soft-sys.matlab:469083


fas <faisalmufti@gmail.com> wrote in message <f4a869df-f422-47d9-
bda7-1daafa173bb1@z16g2000prn.googlegroups.com>...

> > Why is it more difficult than solving
> >
> > Y = W*[ones(100);X]
> >
> > for W?
> >
> > Hope this helps.
> >
> > Greg
> 
> Sorry I could not get you completely. ?
> 
> I would like to know that if we convert a nxm (matrix ) function to 1D
> and then sort it and then polyfit . Can we use the result. As in a 3D
> format( nxm) matrix I cannot use polyfit :(

Why do you state that it does not work?

If your model is

   X =a*Y + b

then polyfit as applied to 

  ab = polyfit(Y(:),X(:),1);

will work. Equally as well, if you use backslash,

  ab = [Y(:),ones(numel(Y),1)]\X(:);

this will also work.

John