next up previous contents index
Next: POLYFIT Up: A. Function Reference Previous: POLY   Contents   Index


POLYCOEF

Syntax: POLYCOEF(X, Y, N)

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
N = polynomial degree in the range 1 to 10

POLYCOEF generates the least squares coefficients for the polynomial fit.

The output of this function is a vector of length N+1 containing

\begin{displaymath}
a_N, a_{N-1}, \cdots, a_1, a_0
\end{displaymath}

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.

Example:

Matrix B1..B5 =

  B
1 1
2 2
3 3
4 4
5 5
   

Matrix C1..C5 =

  C
1 3
2 5
3 11
4 18
5 31
   

POLYCOEF(B1..B5, C1..C5, 2) =
1.6428571
-2.9571429
4.4

Excel function: N/A


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