On Tue, 30 Mar 2004, John Pearson wrote: > I am not very good at math. Please assume I am younger than 9 or older > than 40. Understood. This stuff just leaks away if it isn't constantly refreshed. > 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 > > How do I come up with the equation to corrolate B from A (besides using > analysis software). Hopefully I can program my mpu to determine the > equation needed as I change the values. I think you are asking for the equation of a line that goes through the two points you have, true? Something like this? Call the numbers on the top line A1, B1 and the second line A2, B2. Then B = (B2 - B1)/(A2 - A1)*A + B1-(B2 - B1)/(A2 - A1)*A1 So for your particular example: B = (0 - 2.1)/(30 - 6)*A + 2.1-(0 - 2.1)/(30 - 6)*6 Now, just to check that this is working, if you plug in 6 for A it gives 2.1 for B, if you plug in 30 for A it gives 0 for B, that gives me some hope that I haven't made a mistake, and any other value for A gives a predicted value for B. If you plug in different values for A1, B1, A2, B2 then it should give you a different equation that again should fit a straight line through your two points. Checking this manually with a piece of graph paper might help. Just be careful that you keep the 1's and 2's straight, that is a very common mistake when people change that half way through the solution and can't see why it fails. Then if you want to have more points and a "best fit" line or if you want to do this with parabolas instead of lines, or even want to do this with polynomials instead of lines, then we can go on. Otherwise, hopefully this has been a clear enough solution, with no mistakes, to help you get your work done. -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu