MathGroup Archive 2007

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

Search the Archive

Re: Fit

  • To: mathgroup at smc.vnet.net
  • Subject: [mg76189] Re: Fit
  • From: Ray Koopman <koopman at sfu.ca>
  • Date: Thu, 17 May 2007 06:08:30 -0400 (EDT)
  • References: <f2ejm8$d2$1@smc.vnet.net>

On May 16, 2:42 am, Mathieu G <ellocoma... at free.fr> wrote:
> Hello,
> I have an expression of the form:
>
> 8000000 Sqrt[2/\[Pi]] (-Erf[(-300 + x)/(4000 Sqrt[2])] +
>     Erf[(300 + x)/(4000 Sqrt[2])]) (-1/2 Sqrt[\[Pi]/2]
>       Erf[(-300 + y)/(4000 Sqrt[2])] +
>     1/2 Sqrt[\[Pi]/2] Erf[(300 + y)/(4000 Sqrt[2])])
>
> how can I make a fit using a 2D Gaussian function of the form
>
> Gaussian2D[x_, y_, Radius_, Amplitude_] :=
>    Amplitude Exp[-1/2 ((x/Radius)^2 + (y/Radius)^2)];
>
> Thank you for your help!
> MG

Your expression can be rewritten as f[x]*f[y],
where f[t] = 2000*(Erf[(t + 300)/(4000 Sqrt[2])] -
                   Erf[(t - 300)/(4000 Sqrt[2])],
so the problem is to approximate the unidimensional function f,
which is roughly proportional to the pdf of a normal variable with
mean = 0 and sd = 4000. There are many ways to do the approximation.
Which you choose depends on how you define the badness of fit. The
easiest is to use a series approximation at t = 0, which leads to

g[t_] := With[{a = N[4000*Erf[3/(40*Sqrt[2])]],
               r = N[8000*E^(9/6400)*(2*Pi)^(1/4) *
                     Sqrt[(5/3)*Erf[3/(40*Sqrt[2])]]]},
               (* a = 239.141, r = 4003.75 *)
              a*Exp[-.5(t/r)^2]]

If this fits too poorly away from 0 then adjust the coefficients.



  • Prev by Date: Re: Compatibility woes
  • Next by Date: Re: Compatibility woes
  • Previous by thread: Re: Fit
  • Next by thread: Re: Fit