help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

fminsearch does not move


From: Martijn Brouwer
Subject: fminsearch does not move
Date: Wed, 10 Oct 2012 19:00:51 +0200

Hi,
I am trying to do a 2D non-linear least squares optimisation. I have
image data and would like to subtract a profile that is defined using 6
parameters. For 1D data I always use leasqr, but as far as I could
determine fminsearch or fmins are the best options for optimisation on a
2D domain.
The problem I encounter is that the final fitting parameters returned by
fminsearch are identical to the initial parameters. What is wrong here?

Martijn


function z=profile(xx, yy, rr, p)
  z = p(1)*(1 + p(2)*xx + p(3)*yy + p(4)*xx.^2 +
p(5)*yy.^2).*exp(rr*p(6));
end

f = @(p) sum(sum((QImg - profile(xx,yy,r, p)).^2))/n;

p0=[1, sx, sy, sx2, sy2, 0];

z0 = profile(xx,yy,r, p0);

p = fminsearch(f, p0);


xx, yy, and r are predefined matrices with the x, y and radial
coordinates of the pixels. From commandline I can evaluate f(p), but
apparently fmisearch has a problem with my function.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]