Difference between revisions of "Cubic spline interpolation"

From JSXGraph Wiki
Jump to navigationJump to search
Line 35: Line 35:
 
           }
 
           }
 
           var py = JXG.Math.Numerics.splineEval(px, x, y, F);
 
           var py = JXG.Math.Numerics.splineEval(px, x, y, F);
           return [px,py];
+
           return F;
 
         }           
 
         }           
  
         var c = board.createElement('curve', [computeSpline()], {strokeWidth:3});
+
         var c = board.createElement('curve', ["x",F,"x"], {strokeWidth:3});
  
 
         function addPoint() {
 
         function addPoint() {

Revision as of 18:52, 3 December 2008

Constructs a cubic spline through given points. Points can be added by clicking on "Add point".

        function addPoint() {
          p.push(board.createElement('point',[(Math.random()-0.5)*10,(Math.random()-0.5)*3],{style:6}));
          board.update();
        }