Path: news.mathworks.com!not-for-mail
From: "John D'Errico" <woodchips@rochester.rr.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: the mathematic relationship between two series of data
Date: Sun, 13 Jul 2008 09:03:01 +0000 (UTC)
Organization: John D'Errico (1-3LEW5R)
Lines: 36
Message-ID: <g5cgc5$l7d$1@fred.mathworks.com>
References: <g5c16i$l8c$1@fred.mathworks.com> <g5c6se$rhd$1@fred.mathworks.com>
Reply-To: "John D'Errico" <woodchips@rochester.rr.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 1215939781 21741 172.30.248.37 (13 Jul 2008 09:03:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 13 Jul 2008 09:03:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 869215
Xref: news.mathworks.com comp.soft-sys.matlab:479035



"Matt Fig" <spamanon@yahoo.com> wrote in message 
<g5c6se$rhd$1@fred.mathworks.com>...
> 
> > 
> > A                      B
> > 0.0772               99.92%  

(snip)

> > 0.994908571          30.96%
> > 
> > if A is the independent vairable and B is the dependent 
> > variable, how to find out their mathematic relationships in 
> > Matlab? I have tried in EXCEL but it is not simple linear, 
> 
> 
> Certainly an 11th order polynomial fits the data quite well,
> but a piecewise quadratic isn't bad either:
> 
> P1 = polyfit(A(1:15),B(1:15),2);
> X1 = A(1):.001:A(15);
> Y1 = polyval(P1,X1);
> P2 = polyfit(A(16:end),B(16:end),2);
> X2 = A(16):.001:A(end);
> Y2 = polyval(P2,X2);
> plot(A,B,X1,Y1,X2,Y2)
> 
> 
> I guess it depends on what you expect, and what you want out
> of the data.

The OP should accept that a piecewise quadratic
done in this way will not even be a continuous
function overall.

John