function err = fitgauss2b(lambda,t,y,handle)
% Fitting functions for a Gaussian band spectrum with flat 
% baseline correction. Returns baseline as c(1), position as c(2),
% and width as c(3).
%  T. C. O'Haver, 2006   Updated to Matlab 6, March 2006
global c
A = zeros(length(t),round(length(lambda)/2));
for j = 1:length(lambda)/2,
    A(:,j) = gaussian(t,lambda(2*j-1),lambda(2*j))';
end
B=[ones(size(y))' A];
c = B\y';
z = B*c;
err = norm(z-y');