linefit()

Description:

Perform linear fitting using the least squares method.

Syntax:

linefit(A,Y)

Note:

A least squares fitting technique is to get the nearest possible value of constant vector Y by multiplying coefficient matrix A by vector X, that is, the nearest result of AX=Y. The function performs a linear fitting using the least squares method to get vector X.

Parameters:

A

A coefficient matrix

Y

A constant vector

Return value:

Sequence

Example:

 

A

 

1

[[1,2,3,4],[2,3,1,2],[1,1,1,-1],[1,0,-2,-6]]

 

2

[[2],[3],[-8],[4]]

 

3

=linefit(A1,A2)