MathGroup Archive 2000

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

Search the Archive

Re: Using output of a Fit


In a message dated 8/19/2000 4:58:26 AM, owenzooey at my-deja.com writes:

>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?
>

Use Fit in the definition of a function then use the function as you would 
any other function.

data = Table[7*x + 3 + 10*Random[], {x, 10}];

f[x_] := Evaluate[Fit[data, {1, x}, x]]

Needs["Graphics`Graphics`"]

DisplayTogether[
    ListPlot[data, PlotStyle -> {AbsolutePointSize[3], RGBColor[1, 0, 0]}], 
    Plot[f[x], {x, 0, 10}, PlotStyle -> RGBColor[0, 0, 1]]];


Bob Hanlon


  • Prev by Date: Re: make matrix animate
  • Next by Date: RE: Using output of a Fit
  • Previous by thread: Re: Using output of a Fit
  • Next by thread: RE: Using output of a Fit