Friday, April 15, 2011

Linear Least Squares in Octave

While Octave functions ols and leasqr are good for heavy-lifting, polyfit is often sufficient for simple linear regressions.

Given arrays of data x and y: c = polyfit(x,y,1) gives the regression yfit = c(1) * x + c(2).

No comments:

Post a Comment