function transpoly

Compute the transformation matrix for two reference coordinate systems, with errors. It is described by a second order polynomial. The number of reference sources must be >= 6. The transformation function will be calculated using a least squares fit to given coordinates. Note that if either in REFSTARS or in IMSTARS a coordinate is exactly (-1, -1), this star will not be used to calculate the transformation matrix.

Syntax
result = transmatrix(REFSTARS, IMSTARS, ERRORS)

Arguments
REFSTARS:   A matrix 2xm (m >= 6) with positions of the reference stars in the reference frame (= masterlist)
IMSTARS:   A matrix 2xm (same size as REFSTARS) with the positions of the same stars in the image to be transformed.
ERRORS:   A matrix 2xm (same size as REFSTARS) with the errors of the positions in REFSTARS.


Returns
A matrix 2x12 which describes the coordinate transformation matrix:
   x' = result[1,1] + result[2,1]*x + result[1,2]*y + result[2,2]*xy + result[1,3]*x^2 + result[2,3]*y^2
   y' = result[1,4] + result[2,4]*x + result[1,5]*y + result[2,5]*xy + result[1,6]*x^2 + result[2,6]*y^2
The remaining coordinates [1:2,7:12] are the errors of the respective elements of the transformation matrix.

See also
function transcoords
function transform