Re: Fit
- To: mathgroup at smc.vnet.net
- Subject: [mg76274] Re: Fit
- From: Mathieu G <ellocomateo at free.fr>
- Date: Fri, 18 May 2007 06:33:59 -0400 (EDT)
- References: <f2ejm8$d2$1@smc.vnet.net> <f2hcg5$2cv$1@smc.vnet.net>
CKWong a =E9crit : > f[x_, y_] := 8000000 Sqrt[ > 2/=A3k] (-Erf[(-300 + x)/(4000 Sqrt[2])] + Erf[(300 + x)/(4000 > Sqrt[2])]) (-1/2 Sqrt[=A3k/2] Erf[(-300 + y)/( > 4000 Sqrt[2])] + 1/2 Sqrt[=A3k/2] Erf[(300 + y)/(4000 Sqrt[2]= )]); > > Gaussian2D[x_, y_, Radius_, Amplitude_] := Amplitude > Exp[-1/2 ((x/Radius)^2 + (y/Radius)^2)]; > > > ra = 2*10^4; n = 50; > lst = Flatten[Table[N[{x, y, f[x, y]}], > {x, -ra, ra, ra/n}, > {y, -ra, ra, ra/n}],1]; > > sol = FindFit[lst, Gaussian2D[x, y, Radius, Amplitude], > {{Radius, ra/4},{Amplitude, 10^4}}, {x, y}]; > > g[x_, y_] = Gaussian2D[x, y, Radius, Amplitude] /. sol; > > g is what you wanted. > > Exactly! Thank you as well as all repliers