Least-squares line fitting: Difference between revisions

From JSXGraph Wiki
mNo edit summary
No edit summary
Line 53: Line 53:
for (i=0;i<3;i++) {
for (i=0;i<3;i++) {
     for (j=0;j<3;j++) {
     for (j=0;j<3;j++) {
         A[i][j] /= n;
         //A[i][j] /= n;
     }
     }
}
}
//var res = JXG.Math.Numerics.Jacobi(A);
console.log(A[0]);
console.log(A[0]);
console.log(A[1]);
console.log(A[1]);
console.log(A[2]);
console.log(A[2]);
var res = JXG.Math.Numerics.Jacobi(A);
console.log(res);
/*
/*
// Now, the general linear least-square fitting problem
// Now, the general linear least-square fitting problem

Revision as of 16:56, 9 November 2010

This little JXSGraph application finds the line - described by homogeneous coordinates [a,b,c] - that minimizes

[math]\displaystyle{ \sum_{i=1}^n (ax_i+by_i+cz_i)^2. }[/math]

Coming soon...