Least-squares line fitting: Difference between revisions
From JSXGraph Wiki
A WASSERMANN (talk | contribs) No edit summary |
A WASSERMANN (talk | contribs) No edit summary |
||
Line 50: | Line 50: | ||
A[2][1] += r[i][2]*r[i][1]; | A[2][1] += r[i][2]*r[i][1]; | ||
A[2][2] += r[i][2]*r[i][2]; | A[2][2] += r[i][2]*r[i][2]; | ||
} | |||
for (i=0;i<3;i++) { | |||
for (i=0;i<3;i++) { | |||
A[i][j] /= n; | |||
} | |||
} | } | ||
console.log(A); | console.log(A); |
Revision as of 16:52, 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...