Re: Questions on fitting and plotting data

*To*: mathgroup at smc.vnet.net*Subject*: [mg7993] Re: Questions on fitting and plotting data*From*: Paul Abbott <paul at physics.uwa.edu.au>*Date*: Wed, 30 Jul 1997 23:57:45 -0400*Organization*: University of Western Australia*Sender*: owner-wri-mathgroup at wolfram.com

Daniel Goscha wrote: > In[38]:= > t2 = {{1, 1.5, .5}, {2.3, 2.8, .5}, {3, 3.7, .5}, {4.2, 4.6, .5}, > {5.1, 5, .5}, {6.4, 6.4, .5}, {7.2, 7.7, .5}, {8, 8.9, .5}} > Out[38]= > {{1,1.5,0.5},{2.3,2.8,0.5},{3,3.7,0.5},{4.2,4.6,0.5},{5.1,5,0.5},{6.4,6.4, > > 0.5},{7.2,7.7,0.5},{8,8.9,0.5}} > > In[39]:= > plot1 = ErrorListPlot[t2] > > **now, here is where I start getting the problems - this is obviously > NOT the correct least-square fit solution to the data I have > specified.** You need to drop the error (i.e. last) component from t2 before fitting: In[41]:= Drop[#1, -1]& /@ t2 Out[41]= {{1, 1.5}, {2.3, 2.8}, {3, 3.7}, {4.2, 4.6}, {5.1, 5}, {6.4, 6.4}, {7.2, 7.7}, {8, 8.9}} In[42]:= Fit[%, {1, x}, x] Out[42]= 0.997895 x + 0.434787 Cheers, Paul ____________________________________________________________________ Paul Abbott Phone: +61-8-9380-2734 Department of Physics Fax: +61-8-9380-1014 The University of Western Australia Nedlands WA 6907 mailto:paul at physics.uwa.edu.au AUSTRALIA http://www.pd.uwa.edu.au/Paul God IS a weakly left-handed dice player ____________________________________________________________________