Re: Questions on fitting and plotting data

*To*: mathgroup at smc.vnet.net*Subject*: [mg7981] Re: [mg7952] Questions on fitting and plotting data*From*: seanross at worldnet.att.net*Date*: Wed, 30 Jul 1997 23:57:32 -0400*Sender*: owner-wri-mathgroup at wolfram.com

Daniel Goscha wrote: > > I am *very* low on the Mma learning curve so this may be obvious, but > here is what I am trying to do. I have a set of data that I want to > plot, fit, and then plot the fit over it. The problem I am having is > getting the correct fit and getting it to plot. Here is what I have so > far... > > 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}} > **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.** > > In[40]:= > fit1 = Fit[t2, {1, x }, {x, y}] > Out[40] = > 0.5-5.55112x10^-17 x I assume that your data in t2 is of the form {x,y,f}? If so, when you set up your fit, you specify that 1 and x are your basis functions. Didn't you want y as a basis function as well? Try something like fit1=Fit[t2,{1,x,y},{x,y}] to have it use both x and y in a fitting routine.