function E=gafit(C) % GAFIT(C) - Calculates the error associated with the fitting parameters % C(1) and C(2) in the function C(1) * exp(-C(2) * x^2 ). Requires the % data from gaussfit.dat to calculate the error. % load gaussfit.dat; x=gaussfit(:,1); y=gaussfit(:,2); E = sum(abs(C(1)*exp(-C(2).*x.^2) - y).^2);