3 point quadratic regression formula

While developing the in-process stormer viscometer, one of my goals is to allow the end user to calibrate the device with 3 fluids of known viscosity. With a bit of help from mathematica, I’ve found the formula and for whoever wants it, it’s posted, also for my own future edification. This formula is meant to convert 3 data points of the form {X1,Y1},{X2,Y2},{X3,Y3} into a form of ax^2+bx+c=y. This is probably the fastest way to do this kind of operation on a microcontroller. Here’s an image of the formula

Reverse Quadratic from data

Reverse Quadratic from data

also, here’s a dirty FreeBasic program using it. regress-3point.bas

Also, for fun I decided to do a cubic version. This is in the form of 4 data points {X1,Y1},{X2,Y2},… converting to ax^3+bx^2+cx+d=y

Cubic equation inverse

Cubic equation inverse

You gotta love Mathematica!!!

  1. John
    November 8th, 2009 at 17:11
    Reply | Quote | #1

    Where did you find this 3 point regression formula? I am trying to figure out the formula for 11 point regression. E-mail me at john_withey@my.hnu.edu, if anybody on these boards has the formula to calculate such. thanks.

  2. smackaay
    November 8th, 2009 at 19:40
    Reply | Quote | #2

    I calculated it backwards with gaussian elimination. When I was finished, I plugged it into Mathematica in order to simplify it. Turns out that you can solve it through Mathematica as well, which is what I did for the cubic, 4 point equation. I think what you’re looking for is the Least Squares method, unless of course you’re looking for a solution for the variables to the 10th order. 🙂
    http://en.wikipedia.org/wiki/Least_squares

You must be logged in to post a comment.