Path: news.mathworks.com!not-for-mail
From: "Prakhar " <prakhar_cool@yahoo.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Estimation of variables to minimize the sum of residuals
Date: Tue, 6 Nov 2012 23:16:08 +0000 (UTC)
Organization: California Institute of Technology
Lines: 19
Message-ID: <k7c5no$i8$1@newscl01ah.mathworks.com>
References: <k79nrs$oss$1@newscl01ah.mathworks.com> <k79vn5$kdj$1@newscl01ah.mathworks.com>
Reply-To: "Prakhar " <prakhar_cool@yahoo.com>
NNTP-Posting-Host: www-00-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1352243768 584 172.30.248.45 (6 Nov 2012 23:16:08 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 6 Nov 2012 23:16:08 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1454753
Xref: news.mathworks.com comp.soft-sys.matlab:782199

Thanks Roger. Yeah...i figured it out thats its simple linear regression. Thanks for prompting it out. 

-Prakhar

"Roger Stafford" wrote in message <k79vn5$kdj$1@newscl01ah.mathworks.com>...
> "Prakhar " <prakhar_cool@yahoo.com> wrote in message <k79nrs$oss$1@newscl01ah.mathworks.com>...
> > res = x - f  
> > (e.g.: res(1) = x(1) - (a + b*y(1) + c*y(1)^2).
> > Define sum of square of residuals as: 
> > s = sum(res.^2). 
> > Now, i need to find variables a, b, c in such a way so that the sum of residuals 's' is minimum. 
> - - - - - - - - -
>   This is a simple problem in linear regression.  We assume x and y are column vectors as shown.  Do:
> 
>  abc = [ones(size(y)),y,y.^2]\x;
> 
> where 'abc' will be a three-element column vector containing the optimum a, b, and c coefficients in that order.
> 
> Roger Stafford