Difference between revisions of "Cubic spline interpolation"

From JSXGraph Wiki
Jump to navigationJump to search
Line 15: Line 15:
 
         var p = [];
 
         var p = [];
 
         p[0] = board.createElement('point', [-1,2], {style:6});
 
         p[0] = board.createElement('point', [-1,2], {style:6});
         p[1] = board.createElement('point', [3,-1], {style:6});
+
         p[1] = board.createElement('point', [0,-1], {style:6});
         p[2] = board.createElement('point', [5,0], {style:6});
+
         p[2] = board.createElement('point', [1,0], {style:6});
 +
        p[3] = board.createElement('point', [2,1], {style:6});
  
 
         function computeSpline() {
 
         function computeSpline() {

Revision as of 18:50, 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();
        }