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 23: | Line 23: | ||
n = p.length; | n = p.length; | ||
for (i=0;i<n;i++) { | for (i=0;i<n;i++) { | ||
M.push([1 | M.push([1.0,p[i].X(), p[i].Y(), 1.0]); | ||
y.push(1+p[i].X()*p[i].X() + p[i].Y()*p[i].Y()); | y.push(1+p[i].X()*p[i].X() + p[i].Y()*p[i].Y()); | ||
} | } |
Revision as of 11:49, 7 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...