%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% private_FUNK  Hey, i didn't name it. J.Chandler did. This is the little
% file that provides input as to what function you are
% trying to minimize
%
% called by STEPIT to compute FOBJ
%
% Note this is an example file, to be modified with each problem
%
% This version of FUNK computes the fitted values and the weighted sum
% of squares for the problem of fitting the model:
%
% FIT(J) = X(1)/(1.0 + X(2)*T(J,1) + X(3)*T(J,2))
%
% to data points (T(J,1),T(J,2),Y(J))
%
% Modify matrices T or Y or whatever as needed in this file and in STEPITDRIVER2 file
%
% Ported to Matlab by Jason Lott, University of Alabama at Birmingham
% CONTACT:hoffa@uab.edu
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function a = private_FUNK(b)
global X
global FOBJ
global NPTS
global Y
global T
global YSIG
FITM = zeros(NPTS,1) ; %Same size as our number of points
FOBJ = 0.0D0;
for J=1:NPTS
FITM(J) = X(1)/(1.0D0+X(2)*T(J,1) + X(3)*T(J,2));
FOBJ = FOBJ + ((FITM(J) Y(J))/YSIG(J))^2;
end
