polyfit()

Description:

Calculate the coefficient between two vectors in polynomial fitting.

Syntax:

polyfit(X,Y,n)

Note:

The function calculates the coefficient between vector X and vector Y, which are of same dimension, in a polynomial fitting with the degree of polynomial as n, and returns a sequence of n+1 coefficients ordered from low order to high order.

Parameter:

X/Y

Vectors of same dimension

n

A non-zero positive integer

Return value:

Sequence

Example:

 

A

 

1

[3,5,2,8]

 

2

[4,6,2,4]

 

3

=polyfit(A1,A2,2)

Or can be represented as -0.333333x2+3.666667x-4.