Matlab gaussian fit. , rr] = fmgaussfit(xx,yy,zz) uses ZZ for the surface height.