Posted by
Michael Schmid on
Jun 03, 2011; 9:29am
URL: http://imagej.273.s1.nabble.com/doFit-functions-problem-tp3683803p3683804.html
Hi Wolf,
two possible reasons for such problems:
(1) If the background is not in the fit or not sufficiently constant.
What are your parameters? You can't have a general 2D Gaussian with 4
parameters, you need 8!
v = a + b * exp(-(c*(x-f)^2+d*(x-f)*(y-g)+e*(y-f)^2))
Finding the solution of an 8-parameter fit will usually take some
time and with many parameters there is also a danger of running into
local minima.
Even if the Gaussian has the same width in x and y and no off-
diagonal term, you have 5:
v = a + b * exp(-c*((x-d)^2+(y-e)^2))
(2) Maybe your initial values are not good enough? You can use the
Moment Calculator plugin for the initial values.
Michael
________________________________________________________________
On 2 Jun 2011, at 15:27, wolf indark wrote:
> Dear ImageJ users
>
> I try to perform a gaussian fit froma a macro I am writing. Data is
> 2D. When
> the width of the gaussian curve is narrow, ImageJ doFit function
> does not
> fit the data. I can fit the data to Gaussian curve by changing simlex
> initial guesses.
>
> However, from the macro code, even though I gaved the initialGues
> array for
> the parameters a, b, c, d. But it doesnt change anything. From the
> simlex
> parameter dialog box, when I change the initial parameters, it works.
>
> what is the problem with the macro Fit functions ?
> I will be pleased if you share your opinions.
>
> best regards