%
% fitstepf - function called by "fitstep"
%
%---------------------------------------------------------------
function sos = fitstepf( tau )
%
global time1
global time2
global pv1
global pv2
%
x1 = 1 + tau(1) * exp( - time1 / tau(1) ) / ( tau(2) - tau(1) ) ...
       - tau(2) * exp( - time1 / tau(2) ) / ( tau(2) - tau(1) ) ;
x2 = 1 + tau(1) * exp( - time2 / tau(1) ) / ( tau(2) - tau(1) ) ...
       - tau(2) * exp( - time2 / tau(2) ) / ( tau(2) - tau(1) ) ;
%
sos = ( pv1 - x1 ) * ( pv1 - x1 ) ...
      + ( pv2 - x2 ) * ( pv2 - x2 ) ;
%
return ;
