You are here

public function PHPExcel_Polynomial_Best_Fit::getValueOfYForX in Loft Data Grids 6.2

Same name and namespace in other branches
  1. 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/trend/polynomialBestFitClass.php \PHPExcel_Polynomial_Best_Fit::getValueOfYForX()

* Return the Y-Value for a specified value of X * *

Parameters

float $xValue X-Value: * @return float Y-Value *

Overrides PHPExcel_Best_Fit::getValueOfYForX

1 call to PHPExcel_Polynomial_Best_Fit::getValueOfYForX()
PHPExcel_Polynomial_Best_Fit::_polynomial_regression in vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/trend/polynomialBestFitClass.php
* Execute the regression and calculate the goodness of fit for a set of X and Y data values * *

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/trend/polynomialBestFitClass.php, line 75

Class

PHPExcel_Polynomial_Best_Fit
PHPExcel_Polynomial_Best_Fit

Code

public function getValueOfYForX($xValue) {
  $retVal = $this
    ->getIntersect();
  $slope = $this
    ->getSlope();
  foreach ($slope as $key => $value) {
    if ($value != 0.0) {
      $retVal += $value * pow($xValue, $key + 1);
    }
  }
  return $retVal;
}