original_string: function value($value, $u = 0)
      {
          if (null === $this->x) {
              $this->x = (1 / $this->measurementVector) * $value;
              $this->cov = (1 / $this->measurementVector) * $this->measurementNoise * (1 / $this->measurementVector);
          } else {
              // Compute prediction
              $predX = ($this->stateVector * $this->x) + ($this->controlVector * $u);
              $predCov = (($this->stateVector * $this->cov) * $this->stateVector) + $this->processNoise;
  
              // Kalman gain
              $K = $predCov * $this->measurementVector *
                  (1 / (($this->measurementVector * $predCov * $this->measurementVector) + $this->measurementNoise));
  
              // Correction
              $this->x = $predX + $K * ($value - ($this->measurementVector * $predX));
              $this->cov = $predCov - ($K * $this->measurementVector * $predCov);
          }
  
          return $this->x;
      }
code: function value($value, $u = 0)
      {
          if (null === $this->x) {
              $this->x = (1 / $this->measurementVector) * $value;
              $this->cov = (1 / $this->measurementVector) * $this->measurementNoise * (1 / $this->measurementVector);
          } else {
              // Compute prediction
              $predX = ($this->stateVector * $this->x) + ($this->controlVector * $u);
              $predCov = (($this->stateVector * $this->cov) * $this->stateVector) + $this->processNoise;
  
              // Kalman gain
              $K = $predCov * $this->measurementVector *
                  (1 / (($this->measurementVector * $predCov * $this->measurementVector) + $this->measurementNoise));
  
              // Correction
              $this->x = $predX + $K * ($value - ($this->measurementVector * $predX));
              $this->cov = $predCov - ($K * $this->measurementVector * $predCov);
          }
  
          return $this->x;
      }
code_tokens: function value ( $ value , $ u = 0 ) { if ( null === $ this -> x ) { $ this -> x = ( 1 / $ this -> measurementVector ) * $ value ; $ this -> cov = ( 1 / $ this -> measurementVector ) * $ this -> measurementNoise * ( 1 / $ this -> measurementVector ) ; } else { // Compute prediction $ predX = ( $ this -> stateVector * $ this -> x ) + ( $ this -> controlVector * $ u ) ; $ predCov = ( ( $ this -> stateVector * $ this -> cov ) * $ this -> stateVector ) + $ this -> processNoise ; // Kalman gain $ K = $ predCov * $ this -> measurementVector * ( 1 / ( ( $ this -> measurementVector * $ predCov * $ this -> measurementVector ) + $ this -> measurementNoise ) ) ; // Correction $ this -> x = $ predX + $ K * ( $ value - ( $ this -> measurementVector * $ predX ) ) ; $ this -> cov = $ predCov - ( $ K * $ this -> measurementVector * $ predCov ) ; } return $ this -> x ; }
docstring: Filter a new value
  @param  float $value Measurement
  @param  float|int $u Control
  @return float
docstring_tokens: Filter a new value