next up previous contents index
Next: Basic concepts of Up: Fitting Previous: Retrieving the fitted

The user parametric function

 

When routines HFITH and HFITV are invoked, a user parametric function FUN, specified as an argument to those routines, is called during the minimization procedure.

If the U option is specified with these routines, the user function is calculated in double precision (in the case of HFITHN with the predefined functions (G,E,Pn) double precision is always used). In this case you must reference the common block /HCFITD/,   which contains the parameter values in double precision, and store the resulting function value in variable FITFUN, as shown in the example below.

Example of user function in double precision

      FUNCTION UFIT(X)
*    The dimension of DPAR  ||  MUST be 24!
*                           VV
      DOUBLE PRECISION DPAR(24),FITFUN 
      COMMON/HCFITD/DPAR,FITFUN
      FITFUN = DPAR(1)+DPAR(2)*SQRT(X) +DPAR(3)/X
      UFIT=FITFUN
      END

Even is you do not want to use a double precision function value (i.e. you do not specify the U option), you should still compute the fit function as accurately as possible, using double precision variables in strategic places. This function should also be protected against possible arithmetic exception conditions, like under or overflows and negative arguments for square roots or logarithms.

User specified derivatives

CALL HDERIV (DERIV)

Action: User provided subroutine, which calculates the derivatives of the parameters of the function being fitted. This routine must be called from the user function FUN when option 'D' is selected with HFITH or HFITN.

Input parameter:
DERIV
Array containing the derivatives of the function being fitted.
 


Last update: Tue May 16 09:09:27 METDST 1995