From 45b8ad5eace6dc5fff2e0b445cb5abd3c6b94cb1 Mon Sep 17 00:00:00 2001 From: Eugeniy Mikhailov Date: Wed, 19 Sep 2012 23:14:12 -0400 Subject: fitgaussian2D.m simplified --- fitgaussian2D.m | 9 ++------- 1 file 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; -- cgit v1.2.3