PL FIT - Fit Polynomial to Document file data

(5/26/99)

PURPOSE

Fit a polynomial y=f(x) of degree < 6 to a set of x,y measurements stored in a document file. Evaluated polynomial points can be stored in a new document file.

SEE ALSO

PL [Plot Document file data into Postscript file]
PL HI [Plot Histogram - from Doc file]

USAGE

.OPERATION: PL FIT [a],[b],[c],[d]...

.DOCUMENT FILE: DOC001
[Enter name of input document file.]

.FIRST, LAST KEY NUMBER: 4,45
[Enter first and last key under which the measurements are stored in the document file (it is not possible to leave gaps).]

.COLUMN #S FOR ABSCISSA, ORDINATE (0=KEY): 2,5
[Enter the columns where x and y are stored.]

.SCALEX, SCALEY (DEF=1): 10.5,1
[Enter the size of the x and y units. e.g. if the key is used for x each increment by 1 in the key could be an increment of 10.5 in x.]

.ORDER OF POLYNOMIAL (1-5, DEF=1): 3
[Enter the order of the polynomial that will be fitted to the data. In the example shown the polynomial a+bx+cx**2+dx**3 will be used. The output are the coefficients a,b,c,d. They are printed in the output and also stored in the (optional) register variables e.g. [a],[b],[c],[d]....]

.CREATE OUTPUT DOCUMENT FILE (Y/N): Y
[If Y is selected the polynomial is calculated over a specified range and stored as x, y pairs in a document file.]

If answer is 'Y' following questions appear:

.X FROM, TO: 0.8, 30.7
[Enter range over which the polynomial is to be calculated. Note: the actual range has to be entered; SCALEX is not used for the calculation of the polynomial.]

.IN INTERVALS OF: 0.4
[Enter interval between the calculated points. Note: (XMIN-XMAX)/XIN = (TO-FROM)/INTERVAL+1 currently must not exceed 9999 because only 9999 value pairs can be stored in a document file.]

.DOCUMENT FILE: DOC002
[Enter name of output document file. The lines in this Document file will have the format:
KEY 2 x-value y-value. ]

NOTES

  1. Maximum order of polynomial reduced from 10 to 5 as the algorithm used sometimes fails beyond order 5. May 1999.

SUBROUTINES

POLLSQ, POLFIT

CALLER

PLOT1