Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: extract the exact value from an approximated variable
Date: Mon, 29 Dec 2008 21:03:02 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 41
Message-ID: <gjbdu6$ocp$1@fred.mathworks.com>
References: <gjbb62$7dg$1@fred.mathworks.com> <gjbcj3$2j5$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1230584582 24985 172.30.248.38 (29 Dec 2008 21:03:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 29 Dec 2008 21:03:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1576491
Xref: news.mathworks.com comp.soft-sys.matlab:509141


"Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid> wrote in message <gjbcj3$2j5$1@fred.mathworks.com>...
> "Orchid Bee" <orchidbee08@yahoo.com> wrote in message <gjbb62$7dg$1@fred.mathworks.com>...
> > hi, i am looking for a way to replicate the exact values that i get from a variable in matlab.
> > i have a variable, fitmodel fm1, with the coefficients of the polynomial  that fit the data. if i use the symbolic values of these coefficients in a consequent equation i get different result than if i use the numeric values of the coefficients that are showed for these variables.
> > supposing the case:
> > Linear model Poly9:
> >        fm1(x) = p1*x^9 + p2*x^8 + p3*x^7 + p4*x^6 + 
> >                     p5*x^5 + p6*x^4 + p7*x^3 + p8*x^2 + p9*x + p10
> >      Coefficients (with 95% confidence bounds):
> >        p1 =   8.32e-007  (8.257e-007, 8.383e-007)
> >        p2 = -5.217e-005  (-5.25e-005, -5.185e-005)
> >        p3 =    0.001308  (0.001301, 0.001315)
> >        p4 =    -0.01684  (-0.01693, -0.01676)
> >        p5 =      0.1189  (0.1183, 0.1195)
> >        p6 =     -0.4585  (-0.461, -0.456)
> >        p7 =      0.9485  (0.9422, 0.9547)
> >        p8 =      -1.185  (-1.193, -1.176)
> >        p9 =       1.063  (1.058, 1.068)
> >        p10 =     -0.5639  (-0.565, -0.5629)
> > 
> > i get different result if i use fm1.p1 than if i use 8.32/10^7.
> > nonetheless i need to use the numerical data, not the variable itself; so i'd like to ask you about how can i extract the exact value of the variables? 
> > thank you so very much!
> > 
> > Orchy
> 
>   You haven't stated what kind of fit to the data you are striving for.  If you have exactly ten data points, in general an exact unique fit is possible, but if there are more, then the coefficients you obtain will depend on what sort of fit you want.  This is true symbolically as well as numerically.  For example, a least squares fit can be obtained using the matlab backslash operator '\' and the result of that is exact for a symbolic solution and numerically the accuracy can be to approximately one part in 1e16.
> 
> Roger Stafford

- Hi, Roger.
i'm not sure i get your point. is the type of fit relevant for my issue?
i use polynomial of 9 degree to fit my data whose size varies. 
i used the data to obtain the fit function using 9 degree polynomial. further, i want to make use of the polynomial i get. 
instead of using the expression 
pf = fm1.p1.*myx^9+fm1.p2.*myx^8+ ...
i want to use 
pf = 8.32/(10^7)*myx^9-5.217/(10^5)*myx^8+...

my problem appears as the second pf is different than the first pf. and more certainly that's because fm1.p1 displays a rather approximated value of the first coefficient, so , when i copy it as it is displayed on the screen, i don't get the right coefficient, but that certain approximation. i don't know how to extract the exact numerical value from fm1.p1(, and other similar coefficients).
Orchy