Difference between revisions of "Polynomial regression I"

From JSXGraph Wiki
Jump to navigationJump to search
(New page: <jsxgraph width="700" height="500"> data = "406.60 428.50 429.30 426.30 434.70 415.90 419.00 408.80 410.10 408.30 420.40 415.20 409.70 408.90 411.00 410.60 409.60 409.50 409.80 413.00...)
 
Line 18: Line 18:
 
     for(i=0;i<len;i++) { this.dataY[i] = s.Value()*data[i]; }
 
     for(i=0;i<len;i++) { this.dataY[i] = s.Value()*data[i]; }
 
}
 
}
 +
regressionPolynomial = JXG.Math.Numerics.regressionPolynomial(deg,datax,curve.dataY);  // generateFunction();
 +
 +
reg = brd.createElement('functiongraph',[regressionPolynomial],{strokeColor:'black'});   
 +
brd.createElement('glider',[100,30,reg],{strokeColor:'black'});   
 +
regD = brd.createElement('functiongraph',[brd.D(regressionPolynomial)],{strokeColor:'red'});   
 +
 +
t = brd.createElement('text',[20,40,
 +
            function(){ return "r(x) = " + regressionPolynomial.getTerm();}
 +
            ],
 +
            {strokeColor:'black',fontSize:'14px'});   
  
 
</jsxgraph>
 
</jsxgraph>
 +
 +
===The underlying JavaScript code===
 +
<source lang="xml">
 +
</source>
 +
 +
[[Category:Examples]]

Revision as of 17:07, 19 August 2009

The underlying JavaScript code