Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Fitting data to a curve

  • To: mathgroup at smc.vnet.net
  • Subject: [mg73303] Re: Fitting data to a curve
  • From: "Ray Koopman" <koopman at sfu.ca>
  • Date: Fri, 9 Feb 2007 23:45:57 -0500 (EST)
  • References: <eqengu$4gj$1@smc.vnet.net>

On Feb 8, 12:37 am, Peter Jay Salzman <p... at dirac.org> wrote:
> I have a table of {x,y} data and a function:
>
>    a y^2 + b x y + c x + d y + e  =  x^2
>
> I'd like to do a least fit to determine the constants a, b, c, d, and e.  I
> think the function I want is Fit[] or FindFit[], but I can't coax Mathematica to do
> this.  I'm not entirely sure what to do with that x^2 since it has no
> coefficient.
>
> I've never used these functions before; how can I do this least squares fit?
>
> Thanks!

In[1]:= <<Graphics`ImplicitPlot`
In[2]:= SeedRandom[1]; data = Table[Random[],{30},{2}];
In[3]:= f = Fit[data/.{x_,y_}->{x,y,x^2},{1,x,y,x*y,y^2},{x,y}]
Out[3]= -.0952586 + .887256*x - .128435*y + .354883*x*y - .141003*y^2
In[4]:= ImplicitPlot[f == x^2,{x,0,1},{y,0,1}, Frame->True,
                     Prolog->{AbsolutePointSize[5], Point/@data}];



  • Prev by Date: Array reference help please
  • Next by Date: Re: How to parse result from Reduce[ ] function
  • Previous by thread: Re: Fitting data to a curve
  • Next by thread: Re: Fitting data to a curve