Path: news.mathworks.com!not-for-mail
From: "David Migl" <migl.spam@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Curve fitting - How to get polynomial of form ax^2 + 0x + 0?
Date: Wed, 9 Jul 2008 04:30:20 +0000 (UTC)
Organization: Texas A&#38;M University
Lines: 36
Message-ID: <g51ess$8bo$1@fred.mathworks.com>
References: <g51dfa$q8h$1@fred.mathworks.com> <g51ebe$438$1@fred.mathworks.com>
Reply-To: "David Migl" <migl.spam@gmail.com>
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 1215577820 8568 172.30.248.37 (9 Jul 2008 04:30:20 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 9 Jul 2008 04:30:20 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1399485
Xref: news.mathworks.com comp.soft-sys.matlab:478305



"Miroslav Balda" <balda.nospam@cdm.it.cas.cz> wrote in
message <g51ebe$438$1@fred.mathworks.com>...
> "David Migl" <migl.spam@gmail.com> wrote in message
> <g51dfa$q8h$1@fred.mathworks.com>...
> > Hi,
> > 
> > I am using MATLAB to fit a curve to data. I have a physics
> > formula of the form y=ax^2 and I am trying to determine the
> > value of the constant _a_ using the data. When I fit a
> > second degree polynomial to the data (using polyfit), MATLAB
> > gives me the constants a b and c of the polynomial in the
> > form of ax^2 + bx + c. Of course, that doesn't help me find
> > _a_ for my formula. The extra terms of power<2 throw me off.
> > I need a polynomial of the form ax^2 + 0x + 0 that fits the
> > data. How can I accomplish this?
> 
> Hi
> Very simply. Your problem is a special form of polynomial.
> The coefficient a may be found by the statement
>      
>      a = x(:).^2\y(:);
> 
> It is a reduced form of the polynomial fit, coefficient of
> which can be found from the formula (should x and y be
> column vectors)
> 
>      c = [ones(size(x)), x, x.^2, x.^3,...]\y
> 
> Have a nice day.
> Mira
> 
> 

Thank you very much for your reply; I can almost comprehend
it; forgive my ignorance, but could you please tell me what
x and y represent?