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 14: | Line 14: | ||
for (i=0;i<1000;i++) {  | for (i=0;i<1000;i++) {  | ||
   xr = 10*(Math.random()-0.5);  |    xr = 10*(Math.random()-0.5);  | ||
   yr = 0.  |    yr = 0.*xr+delta*(Math.random()-0.5) +1.0;  | ||
   p.push(brd.create('point',[xr, yr], {withLabel:false}));  |    p.push(brd.create('point',[xr, yr], {withLabel:false}));  | ||
}  | }  | ||
Revision as of 19:41, 5 November 2010
This little JXSGraph application finds the line - described by homogeneous coordinates [a,b,1] - that minimizes
- [math]\displaystyle{ \sum_{i=1}^n (ax_i+by_i+1)^2. }[/math]