linearreg(x, y)

Returns a linear function which is the linear fit of the data in arrays x and y.


See also corrcoeff mean 


Example


x= ( 1, 2, 3 )

1  2  3

y = ( 1, 7, 2 )

1  7  2

f = linearreg( x, y )

f(x) = 0.5000 * x + 2.3333