function sse = fitsigma(sigma_H1H2, rho_H1, rho_H2, t, buildup, sigmaEff_scaling)
%   fitsigma(sigma_H1H2,rho_H1,rho_H2,t,y) returns the SSE between the 
%   data and the values computed by the current function of lambda.
%
%   fitsigma assumes a function of the form
%
%  y = - sigma_H1H2 * ( exp(-lambda_m*t) - exp(-lambda_p*t) ) /delta_lambda;
%  y is the normalized cross peak with respect to the diagonal peak 
%    in the direct dimension.

% eigenvalues for 2 spins systems

lambda_p        = lambdaPlusScaledFun(rho_H1,rho_H2,sigmaEff_scaling,sigma_H1H2);
lambda_m        = lambdaMinusScaledFun(rho_H1,rho_H2,sigmaEff_scaling,sigma_H1H2);

z               = two_spins_build_up_Fun(lambda_p,lambda_m,sigma_H1H2,t,sigmaEff_scaling);

% Sum of Square Error
sse             = norm(z-buildup)^2;

pearson_cross   = corr (z, buildup);
%assignin('base','pearson_cross', pearson_cross) % export pearson_cross to the workspace

Q_cross         = norm(z-buildup)/norm(buildup);
%assignin('base','Q_cross', Q_cross) % export pearson_cross to the workspace

