SUBROUTINE VPHAFN ( * * inputs * : VAR, COEFF, * * outputs * : F0, FVAR, FCOEFF) * * Module number: 15.3.1.3.1 * * Module name: phav * * Keyphrase: * ---------- * Calculate functional values and derivatives of the pulse height distribution * equation. * * Description: * ------------ * For the function: * * F = 0.5 * P * SQRT(2*pi) * [1 - erf((x-Q)/(R*SQRT(2)))] + * S * (exp(-x/T)) + U - y * * where erf is the error function. This is from the assumption that the * pulse height distribution (PHD) has this form: * * PHD = P/R * exp-((x-Q)**2/2*R**2) + S/T * exp(-x/T) * * where P = coeff(1), Q = coeff(2)..., U = coeff(6). * * calculate the functional value F0, for given COEFF's, X, and Y. Also * calculate the partial derivatives of F relative to COEFF (coefficents) and * X, and Y (variables). * * VAR(1) = X, VAR(2) = Y * * FORTRAN name: VDTFN.FOR * * Keywords of accessed files and tables: * -------------------------------------- * Name I/O Description / Comments * None * * Subroutines Called: * ------------------- * CDBS: * CDERFD * SDAS: * None * Others: * None * * History: * -------- * Version Date Author Description * 1 04-15-86 J.-C. HSU design and coding * 2 09-20-87 J.-C. HSU F77 standard * *------------------------------------------------------------------------------- * *== input: * --observed variables at a given point * --(e. g. X and Y coordinates) DOUBLE PRECISION VAR(*), * --coefficients in the given function : COEFF(*) * *== output: * --functional value DOUBLE PRECISION F0, * --partial derivativeS relative to the * --variables and coefficients : FVAR(*), FCOEFF(*) * *== local: * --dummy DOUBLE PRECISION SQRT2, SQRTPI, ERF, EXPO, GAUSS INTEGER STATOK * *------------------------------------------------------------------------------ * * functional value * SQRT2 = SQRT(2.D0) SQRTPI = 2. * SQRT(ATAN(1.D0)) EXPO = (VAR(1) - COEFF(2)) / (SQRT2 * COEFF(3)) GAUSS = EXP(-EXPO**2) * CALL CDERFD (EXPO, ERF, STATOK) * F0 = COEFF(4) * EXP(-VAR(1)/COEFF(5)) + : COEFF(1) * SQRTPI * (1. - ERF) / SQRT2 + : COEFF(6) - VAR(2) * * partial derivatives relative to the coefficients * FCOEFF(4) = EXP(-VAR(1)/COEFF(5)) FCOEFF(5) = VAR(1) * COEFF(4) * FCOEFF(4) / COEFF(5)**2 FCOEFF(1) = SQRTPI * (1. - ERF) / SQRT2 FCOEFF(2) = COEFF(1) * GAUSS / COEFF(3) FCOEFF(3) = COEFF(1) * (VAR(1) - COEFF(2)) * GAUSS / COEFF(3)**2 FCOEFF(6) = 1.D0 * * partial derivatives relative to the variables * FVAR(1) = -COEFF(4) * FCOEFF(4) / COEFF(5) - FCOEFF(2) * FVAR(2) = -1.D0 * RETURN END