Re: Fit
- To: mathgroup at smc.vnet.net
- Subject: [mg76173] Re: Fit
- From: dh <dh at metrohm.ch>
- Date: Thu, 17 May 2007 06:00:14 -0400 (EDT)
- References: <f2ejm8$d2$1@smc.vnet.net>
Hi Mathieu, it depend what you want to do. If it is important that the approximation is good near a point, e.g. 0, one can expand both function in a series and equate the coefficients: Series[f[x,y],{x,0,2},{y,0,2}]//Normal//N Series[Gaussian2D[x,y,rad,amp],{x,0,2},{y,0,2}]//Normal//N in your case we would euqte the zero and quadratic (x^2,y^2 have the same factor) terms. On the otherhand, if the approximation is to be used over a region, one can do it numerical. Choose enough points in the region, calculate the function values at these points and use e.g. FindFit to fit the Gaussion. hope this helps, Daniel Mathieu G 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 >