MathGroup Archive 2005

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

Search the Archive

Re: Coefficients from Fit as a list?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg63415] Re: Coefficients from Fit as a list?
  • From: Bill Rowe <readnewsciv at earthlink.net>
  • Date: Fri, 30 Dec 2005 02:32:32 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

On 12/29/05 at 2:57 AM, lectorz at mail.ru (LectorZ) wrote:

>How can I store the coefficients from the Fit function as a list?

This can be done with CoefficientList. For example,

In[1]:=
data = Table[n + Random[], {n, 10}]; 
m = Fit[data, {1, x}, x]

Out[2]=
0.9611100607503279*x + 0.6369661439363206

In[3]:=
CoefficientList[m, x]

Out[3]=
{0.6369661439363206, 0.9611100607503279}

But rather than using Fit, you could use FindFit and immediately get a list of the coefficients, i.e.,

In[4]:=
FindFit[data, a*x + b, {a, b}, x]

Out[4]=
{a -> 0.9611100607503279, b -> 0.636966143936322}
--
To reply via email subtract one hundred and four


  • Prev by Date: Re: Coefficients from Fit as a list?
  • Next by Date: Re: Coefficients from Fit as a list?
  • Previous by thread: Re: Coefficients from Fit as a list?
  • Next by thread: Re: Coefficients from Fit as a list?