Quote Originally Posted by Philip Nicoletti View Post
f.y.i. the algorithm that I gave you calculated the same slope that
you provided in your sample data set.

Here is a code snippet to do the calculation :


// values needed prior to code snippet
//
// int n = number of (x,y) points
// double x[ i ] for i = 0 to n-1 ... the x points
// double y[ i ] for i = 0 to n-1 ... the y points
//

double s0 = 0;
double s1 = 0;
double s2 = 0;
double t0 = 0;
double t1 = 0;

for (int i=0; i<n; i++)
{
s0++;
s1 = s1 + x[ i ];
s2 = s2 + x[ i ]*x[ i ];
t0 = t0 + y[ i ];
t1 = t1 + x[ i ]*y[ i ];
}

double M = ( s0*t1 - s1*t0 ) / (s0*s2 - s1*s1) ; // slope

double B = ( s2*t0 - s1*t1 ) / (s0*s2 - s1*s1) ; // y-intercept
Hi thanks for this code,but can you help me to get the regression..y=mx+b? what is the value of x? is it the iteration of data or the total absorbance? or conc? Please email me at [email protected]. Thanks bro.