SCULIB_FIT_2D_PARABOLA

fit 2d parabola to data

Description:

This routine performs a least-squares fit of a 2d parabola to a set of data. The form of the parabola is:-
z = A0 + A1 (xX0)2 + A1 (yY0)2 (37)

The apex of the parabola is at X0,Y0 and its value there is A0.

If status is good on entry the routine will work through the data calculating the various sums required for the least-squares method. Data with bad quality or zero variance are ignored. If no ‘good’ data are found then an error will be reported and the routine will return with bad status.

A matrix equation of the form MB = Z is constructed, where:-

M = 1 var x var y var x2+y2 var x var x2 var xy var x3+xy2 var y var xy var y2 var x2y+y3 var x2+y2 var x3+xy2 var x2y+y3 var (x2+y2)2 var (38)
B = A0 + A1 X02 + A1 Y02 2 A1 X0 2 A1 Y0 A1 (39)
Z = z var xz var yz var (x2+y2)z var (40)

where x, y, z and var are the x,y coords, value and variance of the measured points and the sums are over all valid points.

SCULIB_INVERT_MATRIX is called to invert the matrix and SCULIB_FIT_MULT to multiply Z by the inverse. This yields the fitted value for B from which the other fit parameters are derived.

Invocation

CALL SCULIB_FIT_2D_PARABOLA (N, DATA, VARIANCE, QUALITY, X, Y, A0, A1, X0, Y0, Z_PEAK, Z_PEAK_VAR, BADBIT, STATUS)

Arguments

N = INTEGER (Given)
number of data points
DATA (N) = REAL (Given)
the data
VARIANCE (N) = REAL (Given)
variance on the data
QUALITY (N) = BYTE (Given)
the quality on the data
X (N) = REAL (Given)
the x offsets of the data
Y (N) = REAL (Given)
the y offsets of the data
A0 = REAL (Returned)
fit result
A1 = REAL (Returned)
fit result
X0 = REAL (Returned)
x coord of parabola apex
Y0 = REAL (Returned)
y coord of parabola apex
Z_PEAK = REAL (Returned)
the value of the parabola apex
Z_PEAK_VAR = REAL (Returned)
the variance on Z_PEAK
BADBIT = BYTE (Given)
bad bit mask
STATUS = INTEGER (Given and returned)
global status

Notes:

If the variances are not a true reflection of the errors on the data then very strange numbers can result.

Copyright

Copyright ©1995,1996,1997,1998,1999 Particle Physics and Astronomy Research Council. All Rights Reserved.