MathGroup Archive 2003

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

Search the Archive

Re: curve fitting

  • To: mathgroup at smc.vnet.net
  • Subject: [mg40827] Re: curve fitting
  • From: Erich Mueller <emueller at mps.ohio-state.edu>
  • Date: Sat, 19 Apr 2003 23:03:53 -0400 (EDT)
  • Organization: Ohio State University
  • References: <b7qono$3in$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Dear CB,

This is not what one usually thinks of as "curve fitting".  The function f
which you find is a set of cubic splines which runs through all of your
data points.  By construction f runs through all of your data points.

The plot of f might not look like it runs through all of the points.  This
is because the plot algorithm is not sampling at enough points.  Try the
following, where the "PlotPoints" option is used to increase the number
of sampling points:
Plot[f[x], {x, xmin, xmax},
 PlotStyle -> RGBColor[0, 0, 1],
 Epilog -> {AbsolutePointSize[5],
 RGBColor[1, 0, 0], Point /@ data},
 ImageSize -> 400,
 PlotPoints->100]

As for comparison with Excel.  You will have to say what Excel shows you.

Erich


On Sat, 19 Apr 2003, C B wrote:

> please look at the following mathematica code which I actually got from some
> of the good people on this newsgroup. The plot obtained in the last line of
> the code, does not really look exactly line the plot given by Microsoft
> EXcel. Can anyone explain what they are different ? Is it possible to obtain
> an interpolation function for the plot the way it appears in Excel?
>
> Are there any ways in Mathematica of getting information about the errors in
> the curve fitting?
>
>
>
> data = {{0, 3.786392146}, {15, 3.81806915}, {30, 3.880044496}, {45,
>       4.31622824}, {60, 4.523878538}, {90, 4.900042894}, {120,
>       5.175422767}, {150, 5.217956939}, {180, 5.262434094}, {240,
>       5.377787989}, {300, 5.36486329}, {360, 5.241879526}, {420,
>       5.234405371}, {480, 5.228778272}, {540, 5.219441168}, {600,
>       5.230700617}, {660, 5.305355251}, {720, 5.41936145}, {780,
>       5.50345499}, {840, 5.524101499}, {900, 5.546731139}, {960,
>       5.498010869}, {1020, 5.574792174}, {1080, 5.600864814}, {1140,
>       5.589530789}, {1200, 5.537377461}, {1260, 5.455131015}, {1320,
>       5.342847014}, {1380, 5.344745156}, {1440, 5.344745156}}
>
>
> << NumericalMath`NIntegrateInterpolatingFunct`
>
> f = Interpolation[data]
>
> NIntegrateInterpolatingFunction[f[x], {x, 0, 1440}]
>
> xmin = Min[data[[All, 1]]]
> xmax = Max[data[[All, 1]]]
>
>
> Plot[f[x], {x, xmin, xmax},
> PlotStyle -> RGBColor[0, 0, 1],
> Epilog -> {AbsolutePointSize[5],
> RGBColor[1, 0, 0], Point /@ data},
> ImageSize -> 400]
>
>
>
>
>
>
>
>
>



  • Prev by Date: Re: Solving for a function in an Integral
  • Next by Date: Re: Solving for a function in an Integral
  • Previous by thread: curve fitting
  • Next by thread: Re: curve fitting