next up previous contents index
Next: PPMT Up: A. Function Reference Previous: POLYCOEF   Contents   Index


POLYFIT

Syntax: POLYFIT(X, Y, d)

X = a range representing a row or column vector of independent variable values
Y = a range representing a row or column vector of dependent variable values
d = polynomial degree in the range 1 to 10

POLYFIT generates the least squares polynomial fit. The output of this function is the vector of estimated y-values on the left hand side of the above equation. The input vector X and Y must both be row vectors or both column vectors. The output vector will be a row vector if X and Y are row vectors, and a column vector if X and Y are column vectors. The length of the output vector is equal the the length of the input vectors.

Example:

Matrix B1..B5 =

  B
1 1
2 3
3 3
4 4
5 5
   

Matrix C1..C5 =

  C
1 3
2 5
3 11
4 18
5 31
   

POLYFIT(B1..B5, C1..C5, 2) =
3.0857143
5.0571429
10.314286
18.857143
30.685714

Excel function: N/A


next up previous contents index
Next: PPMT Up: A. Function Reference Previous: POLYCOEF   Contents   Index
SpreadScript User's Guide, Version 1.2
Grey Trout Software
02 March 2003