Difference between revisions of "Least-squares circle fitting"

From JSXGraph Wiki
Jump to navigationJump to search
Line 2: Line 2:
 
var brd = JXG.JSXGraph.initBoard('jxgbox',{boundingbox:[-5,5,5,-5], keepaspectratio:true});
 
var brd = JXG.JSXGraph.initBoard('jxgbox',{boundingbox:[-5,5,5,-5], keepaspectratio:true});
  
var i, p = [], angle, co, si;
+
var i, p = [], angle, co, si, delta = 0.2;
  
 
for (i=0;i<50;i++) {
 
for (i=0;i<50;i++) {
 
   angle = Math.random()*2*Math.PI;
 
   angle = Math.random()*2*Math.PI;
   co = 4*Math.cos(angle);
+
 
   si = 4*Math.sin(angle);
+
   co = 4*Math.cos(angle)+delta*(Math.random()-0.5);
 +
   si = 4*Math.sin(angle)+delta*(Math.random()-0.5);
 
   p.push(brd.create('point',[co, si], {withLabel:false}));
 
   p.push(brd.create('point',[co, si], {withLabel:false}));
 
}
 
}

Revision as of 17:32, 5 November 2010

Catgegory:Statistics