Least-squares line fitting: Difference between revisions

From JSXGraph Wiki
No edit summary
No edit summary
Line 42: Line 42:
var xm = z[0]*0.5;
var xm = z[0]*0.5;
var ym = z[1]*0.5;
var ym = z[1]*0.5;
var r = Math.sqrt(z[2]+zm*zm+xm*xm+ym*ym);
var r = Math.sqrt(z[2]+xm*xm+ym*ym);


brd.create('circle',[ [zm,xm,ym], r]);  
brd.create('circle',[ [xm,ym], r]);  
//alert([xm,ym,r].toString());
//alert([xm,ym,r].toString());
/*
/*

Revision as of 11:51, 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...