@@ 1731-1748 (lines=18) @@ | ||
1728 | * @param boolean A logical value specifying whether to force the intersect to equal 0. |
|
1729 | * @return array of float |
|
1730 | */ |
|
1731 | public static function GROWTH($yValues,$xValues=array(),$newValues=array(),$const=True) { |
|
1732 | $yValues = PHPExcel_Calculation_Functions::flattenArray($yValues); |
|
1733 | $xValues = PHPExcel_Calculation_Functions::flattenArray($xValues); |
|
1734 | $newValues = PHPExcel_Calculation_Functions::flattenArray($newValues); |
|
1735 | $const = (is_null($const)) ? True : (boolean) PHPExcel_Calculation_Functions::flattenSingleValue($const); |
|
1736 | ||
1737 | $bestFitExponential = trendClass::calculate(trendClass::TREND_EXPONENTIAL,$yValues,$xValues,$const); |
|
1738 | if (empty($newValues)) { |
|
1739 | $newValues = $bestFitExponential->getXValues(); |
|
1740 | } |
|
1741 | ||
1742 | $returnArray = array(); |
|
1743 | foreach($newValues as $xValue) { |
|
1744 | $returnArray[0][] = $bestFitExponential->getValueOfYForX($xValue); |
|
1745 | } |
|
1746 | ||
1747 | return $returnArray; |
|
1748 | } // function GROWTH() |
|
1749 | ||
1750 | ||
1751 | /** |
|
@@ 3329-3346 (lines=18) @@ | ||
3326 | * @param boolean A logical value specifying whether to force the intersect to equal 0. |
|
3327 | * @return array of float |
|
3328 | */ |
|
3329 | public static function TREND($yValues,$xValues=array(),$newValues=array(),$const=True) { |
|
3330 | $yValues = PHPExcel_Calculation_Functions::flattenArray($yValues); |
|
3331 | $xValues = PHPExcel_Calculation_Functions::flattenArray($xValues); |
|
3332 | $newValues = PHPExcel_Calculation_Functions::flattenArray($newValues); |
|
3333 | $const = (is_null($const)) ? True : (boolean) PHPExcel_Calculation_Functions::flattenSingleValue($const); |
|
3334 | ||
3335 | $bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR,$yValues,$xValues,$const); |
|
3336 | if (empty($newValues)) { |
|
3337 | $newValues = $bestFitLinear->getXValues(); |
|
3338 | } |
|
3339 | ||
3340 | $returnArray = array(); |
|
3341 | foreach($newValues as $xValue) { |
|
3342 | $returnArray[0][] = $bestFitLinear->getValueOfYForX($xValue); |
|
3343 | } |
|
3344 | ||
3345 | return $returnArray; |
|
3346 | } // function TREND() |
|
3347 | ||
3348 | ||
3349 | /** |