summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fitgaussian2D.m9
1 files changed, 2 insertions, 7 deletions
diff --git a/fitgaussian2D.m b/fitgaussian2D.m
index 7cf52b9..a852b56 100644
--- a/fitgaussian2D.m
+++ b/fitgaussian2D.m
@@ -76,15 +76,10 @@ options.Display = 'iter';
options.TolFun = tol;
initpar = [cx,cy,sx,sy,PeakOD,theta,background];
%this is to avoid errors when doing fits on the image full of zeros
-if isnan(sum(sum(Gaussian2Dff(initpar,X,Y,m)))) < 1
+if isnan(sum(sum(Gaussian2D(initpar,X,Y)-m))) < 1
% Here is the actual fit
- fp = lsqnonlin( @(pt) Gaussian2Dff(pt,X,Y,m),initpar,LB,UB,options);
+ fp = lsqnonlin( @(pt) Gaussian2D(pt,X,Y)-m,initpar,LB,UB,options);
else
fp = [0,0,0,0,0,0,0];
end;
-
-
-% 2D Gauss function
-function [z] = Gaussian2Dff(p,X,Y,m);
-z = Gaussian2D(p,X,Y) - m;