/****************************************************************/ /* find_normal() - Function to find the set of normal equations */ /* that allow a quadratic trend surface to be */ /* fitted through N points using least squares */ /* V.1.0, Jo Wood, 27th November, 1994. */ /****************************************************************/ #include "param.h" void find_normal(double **normal, /* Matrix of cross-products. */ double *w) /* Weights matrix. */ { int edge=EDGE; /* Store (wsize-1)/2 to save */ /* on computation */ float x,y, /* Local coordinates of window. */ x1=0,y1=0, /* coefficients of X-products. */ x2=0,y2=0, x3=0,y3=0, x4=0,y4=0, xy2=0, x2y=0, xy3=0, x3y=0, x2y2=0,xy=0, N=0; int row,col; /* Pass through local window. */ /* Initialise sums-of-squares and cross products matrix */ for (row=0; row<6; row++) for (col=0; col<6;col++) normal[row][col] = 0.0; /* Calculate matrix of sums of squares and cross products */ for (row=0; row