MathGroup Archive 2009

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

Search the Archive

Re: Fitting a Function with no closed form

  • To: mathgroup at smc.vnet.net
  • Subject: [mg98671] Re: Fitting a Function with no closed form
  • From: dh <dh at metrohm.com>
  • Date: Thu, 16 Apr 2009 04:12:17 -0400 (EDT)
  • References: <gs47hd$7kn$1@smc.vnet.net>


Hi Adam,

you can calculate data pairs: d={{x1,y1},{x2,y2}..}

You also have the specified function F[x,p1,p2], where p1 and p2 are the 

parameter to fit. Then you can calculate the parameters by e.g.:

FindFit[d,F[x,p1,p2],{p1,p2},x]

Here is an example:

=========================

d = Table[{x, RandomReal[{-1, 1}] + 2  Exp[0.1  x]}, {x, 0, 10}];

F[x_, p1_, p2_] := p1 Exp[p2 x];

FindFit[d, F[x, p1, p2], {p1, p2}, x]

=========================

Daniel





Adam Dally wrote:

> I have a histogram which I am trying to fit with a convoluted function.

> 

> I get out the list of bin counts easy enough, but I can't figure out a way

> to fit the function to the data.

> 

> This is the function:

> F(x)=Re[NIntegrate [normalizer*(E0 - u)^2 Sqrt[1 - m^2/(E0 - u)^2]*Exp[(-((x

> - u)^2/(2 \[Sigma]^2)))/(Sqrt[2 \[Pi]] \[Sigma])], {u, 0, E0}]]

> "E0" and "sigma" are known constants. "Normalize" and "m" are the fitting

> parameters.

> 

> I can get a plot or of a table of values out of the function by:

> Plot[F(x),{x, minRange, maxRange}]

> Table[F(x),{x, minRange, maxRange, binWidth}]

> 

> Is there a way to fit using a function like this? I would also like to error

> bars on the fit parameters.

> 

> Thank you,

> Adam Dally

> 




  • Prev by Date: Mathematica 7 problems
  • Next by Date: Re: Problems in plotting Lyapunov Exponents:
  • Previous by thread: Re: Fitting a Function with no closed form
  • Next by thread: Re: Trouble with FullSimplify