Last active
March 13, 2017 09:39
-
-
Save SarvagyaVaish/57c326c1faed89694e4d4b06d397d3fe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Compute 'm' errors, one for each data point, for the given parameter values in 'x' | |
int operator()(const Eigen::VectorXf &x, Eigen::VectorXf &fvec) const | |
{ | |
// 'x' has dimensions n x 1 | |
// It contains the current estimates for the parameters. | |
// 'fvec' has dimensions m x 1 | |
// It will contain the error for each data point. | |
float aParam = x(0); | |
float bParam = x(1); | |
float cParam = x(2); | |
for (int i = 0; i < values(); i++) { | |
float xValue = measuredValues(i, 0); | |
float yValue = measuredValues(i, 1); | |
fvec(i) = yValue - (aParam * xValue * xValue + bParam * xValue + cParam); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment