Re: Using output of a Fit

• To: mathgroup at smc.vnet.net
• Subject: [mg24923] Re: Using output of a Fit
• From: adam_smith at my-deja.com
• Date: Sun, 20 Aug 2000 01:35:18 -0400 (EDT)
• References: <8nlib8\$9gi@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

Keith,

I hope the following is what you want.  I created some "fake" data
called data.  Then assigned the output of Fit[data,{1,x},x] to the
name "fitfunc".  I then tested "fitfunc".

In[1]:=
data = Table[ {x, 5*x - 3 + Random[Real, {-1, 1}]}, {x, -5, 5}]

Out[1]=
{{-5, -28.1144}, {-4, -22.8667}, {-3, -18.7241}, {-2, -12.0062}, {-1, \
-7.57834}, {0, -3.78138}, {1, 1.4246}, {2, 6.82061}, {3, 11.7552}, {4,
16.994}, {5, 21.8538}}

In[2]:=
fitfunc = Fit[data, {1, x}, x]

Out[2]=
-3.11118 + 4.97617 x

In[3]:=
fitdata = Table[{x, fitfunc}, {x, -5, 5}]

Out[3]=
{{-5, -27.992}, {-4, -23.0159}, {-3, -18.0397}, {-2, -13.0635}, {-1, \
-8.08735}, {0, -3.11118}, {1, 1.86499}, {2, 6.84115}, {3, 11.8173}, {4,
16.7935}, {5, 21.7697}}

Adam Smith
In article <8nlib8\$9gi at smc.vnet.net>,
owenzooey at my-deja.com wrote:
> I've used
>
> Fit[data,{1,x},x]
>
> to determine a best-fit line.
>
> How can I automatically send the output of Fit to be evaluated using
> different values of x?
>
> Thanks,
> Keith N.
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>
>

Sent via Deja.com http://www.deja.com/
Before you buy.

• Prev by Date: Re: functional routine for {a, b, c, ...} -> {a - b, b - c, c - ...}
• Next by Date: RE: Re: Mathematica newbie
• Previous by thread: RE: Using output of a Fit
• Next by thread: Re: Using output of a Fit