%
%  fitdistf - function called by "fitdist"
%
%--------------------------------------------------------
function sos = fitdistf( pm )
%
global t
global yact
global r
global pfix
global pp
%
p = pp;
j = 1;
for i = 1:5,
  if pfix(i) == 0,
    p(i) = pm(j);
	j = j + 1;
  end;
end;
y = p(1) + p(2) *  ( sin( ( 2 * pi * t / 24 ) ...
                                 + ( pi * p(4) ) ) ...
         + p(3) * sin( ( 2 * pi * t / 12 ) ...
		                 + ( pi * ( p(4) + p(5) ) ) ) );
%
r = yact - y;
sos = r' * r;
return;

