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 20:40:03 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 29
Message-ID: <gjbcj3$2j5$1@fred.mathworks.com>
References: <gjbb62$7dg$1@fred.mathworks.com>
Reply-To: <HIDDEN>
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 1230583203 2661 172.30.248.35 (29 Dec 2008 20:40:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 29 Dec 2008 20:40:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:509138


"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