MathGroup Archive 2012

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

Search the Archive

Re: Using Fit to interpolate data

  • To: mathgroup at smc.vnet.net
  • Subject: [mg127457] Re: Using Fit to interpolate data
  • From: "Kevin J. McCann" <kjm at KevinMcCann.com>
  • Date: Thu, 26 Jul 2012 03:34:25 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: mathgroup-newout@smc.vnet.net
  • Delivered-to: mathgroup-newsend@smc.vnet.net
  • References: <jullkd$ptc$1@smc.vnet.net>

One last go at it:

fiberDataDensitiesFeierabend = {{16, 0}, {10.7, 0.11}, {10.4,
     0.19}, {9.77, 0.41}, {8.29, 3.05}, {7.14, 19.86}};
model = A Exp[-a x + b];
params = FindFit[fiberDataDensitiesFeierabend, model, {A, a, b}, x]
f[x_] = model /. params
min = Min[fiberDataDensitiesFeierabend[[All, 1]]];
max = Max[fiberDataDensitiesFeierabend[[All, 1]]];
{min, max}
p1 = ListPlot[fiberDataDensitiesFeierabend,
    PlotStyle -> {Red, AbsolutePointSize[7]}, PlotRange -> All];
Plot[f[x], {x, min, max}, Epilog -> p1[[1]], Frame -> True,
  FrameStyle -> AbsoluteThickness[2], GridLines -> Automatic,
  PlotRange -> All,
  BaseStyle -> {FontFamily -> "Arial", FontSize -> 12,
    FontWeight -> Bold}
  ]

Cheers,

Kevin

On 7/24/2012 4:16 AM, Kris Carlson wrote:
> Hi,
>
> Can someone enlighten me about how to fit a curve to data? These data are
> of the density of axons of given diameters in the spinal cord. The density
> of smaller fibers is dramatically larger than that of larger fibers. There
> cannot be density < 0 of any diameter, so heuristically to prevent a fit
> yielding an equation that dips below 0 I added an end point with fiber
> diameter = 16 that is 0. Then using Fit I try to increase the exponent of x
> until the curve doesn't yield negative values. The fit looks good in large
> scale but when I plot the region of greatest interest, 8 < x < 14, it no
> longer looks so good. Maybe I am simply ignorant about fitting a curve to
> somewhat irregular data? Or can it be done?
>
> Thank you.
>
> Kris
>
> fiberDataDensitiesFeierabend = {{16, 0}, {10.7, 0.11}, {10.4,
>      0.19}, {9.77, 0.41}, {8.29, 3.05}, {7.14, 19.86}};
>
> fbddPlot =
>   ListPlot[fiberDataDensitiesFeierabend,
>    PlotMarkers -> {Automatic, Medium}]
>
> fbddFit = Fit[fiberDataDensitiesFeierabend, {1, x, x^-13}, x]
>
> Show[Plot[fbddFit, {x, 4, 20},
>    PlotRange -> {{4.5, 20}, {-0.5, 25}}], fbddPlot]
>
> Show[Plot[fbddFit, {x, 4, 28},
>    PlotRange -> {{8, 16}, {-0.5, 1}}], fbddPlot]
>
>




  • Prev by Date: Re: Can anyone see a faster way to compute quantities for a pair or
  • Next by Date: how to jump from one cell to the other using the keyboard?
  • Previous by thread: Re: Using Fit to interpolate data
  • Next by thread: Re: Using Fit to interpolate data