Auto Gaussian & Gabor Surface fit

Functions to fit a 1D Gaussian to a curve and a 2D Gaussian or Gabor to a surface. The routines are automatic in the sense that they do not require the specification of starting guesses for the model parameters. This is done by evaluating the quality of fit for many different choices of parameters then refining the most promising set of params through leastsquares (exhaustive search followed by refinement).
All functions support 2 methods for computing error bars on the parameters: bootstrapping and MCMC.
autoGaussianSurf(xi,yi,zi) fits a 2D Gaussian to a surface, defined as:
zi = a*exp(((xix0).^2/2/sigmax^2 + (yiy0).^2/2/sigmay^2)) + b
It can also fit a tilted 2d Gaussian or isotropic 2d Gaussian.
autoGaborSurf(xi,yi,zi) fits a Gabor, defined as:
zi = a*exp((xip,.^2+yip.^2)/2/sigma^2)*cos(2*pi*xip/lambda + phase) + b
Where:
xip = (xix0)*cos(theta) + (yii0)*sin(theta);
yip =(xix0)*sin(theta) + (yii0)*cos(theta);
The Gabor fit calls autoGaussianSurf internally, using the fact that the absolute value of a Gabor in the Fourier domain is a Gaussian.
autoGaussianCurve(xi,zi) fits a 1D Gaussian to a curve.
