I'm currently working on a project in which I need to find the tilt of a surface. Let's assume I'm only concerned with a single dimension tilt (i.e. slope) to begin.
I currently have the ability to calculate a least-squared slope when processing batch data. However, this requires me to batch all the data prior to performing the calculation.
Is there instead a recursive form for computing the least squares linear fit such that I'm not required to batch the data prior to performing the calculation? Instead I would like to continuously update the least squares slope for each new data point that is received. The motivation to this is that I could avoid saturation/overflows due to batching data.
If you still don't understand what I'm asking, refer to this web page here which outlines a recursive form for calculating the mean - http://www.heikohoffmann.de/htmlthesis/node134.html. The advantage of using this method is that you don't need to keep any large sums going thus avoiding potential overflows, and instead, you simply weight the new data against the previously calculated mean.