Okay, so maths isn't my strong point!
I have this data, I i used zunzun.com to create a User Defined Polynomial curve for my data, which came out as y = a + bx1 + cx2 + dx3 + ex4 + fx5
However, when I use the code suggested:
double a = -4.2294409347240979E+01;
double b = 5.5946102161174718E+00;
double c = -1.3446057748924720E-01;
double d = 1.5448461146899649E-03;
double e = -8.2537158069276241E-06;
double f = 1.7176546321558128E-08;
temp = f;
temp = temp * x_in + e;
temp = temp * x_in + d;
temp = temp * x_in + c;
temp = temp * x_in + b;
temp = temp * x_in + a;
return temp;
It gives me the 'sum of squared absolute error'? Say for X value 94, I should get a value of about 60.3, but this code gives me -46.152. I realise I am being stupid and am obviously missing an equation on the end. But can anyone help me predict my Y value from my X with this forumla? The graph fits its really well and would be great to not have to use a lookup table.
Many Thanks!
X Y
180 200
178 190
176 180
174 170
170 160
168 150
164 140
160 130
154 120
149 110
142 100
134 90
122 80
110 70
92 60
66 50
30 40
Thanks everyone! Code is working now: http://img72.imageshack.us/img72/3705/ps3lrftest.png