%-------------------------------------------------------------------------- % function chisq = gausschisq(para,x,d) % % d distribution to be tested % x variable of distribution d % % para [s,c,z] % s sigma, % c amplitude, % z shift along x % % returns: % chi square with the assumption of a gaussian distribution % % 2-May-2003 S.Schreiber %-------------------------------------------------------------------------- function chisq = gausschisq(para,x,d) if isempty(x) | isempty(d) chisq = 9999; return end if size(x) ~= size(d) chisq = 9999; return end if para(1) <= 0 chisq = 9999; return end r = gauss(para,x); csq = (d-r).^2; chisq = sum(csq); return