pic microcontroller discussion list wrote: > I want my mpu to be able to create values for a linear regression > equation from 4 values that are entered, example: > > When A = 6, B = 2.1 > When A = 30, B = 0 > besides the other answers already given, the generic formula for finding the slope given many samples is: slope = ((n*SumXY) - (SumX*SumY)) / ((n*SumX^2) - (SumX)^2) where n = number of samples, and "Sum" should be taken as "sigma". For example, SumXY is the summation of all X*Y, and SumX^2 would be the summation of all X^2. I've done this on an '877. If you only have four values, definitely use one of the other methods! -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu