|
Unfit
3.1.1
Data fitting and optimization software
|
Fit a four parameter Gaussian curve to some data. More...
#include <GaussianEquation.hpp>
Public Member Functions | |
| GaussianEquation (const std::vector< double > &data_x, const std::vector< double > &data_y) | |
| std::vector< double > | operator() (const std::vector< double > ¶m) |
Public Member Functions inherited from Unfit::GenericCostFunction | |
| virtual | ~GenericCostFunction () |
Private Attributes | |
| const std::vector< double > | data_x_ |
| const std::vector< double > | data_y_ |
Fit a four parameter Gaussian curve to some data.
Here the goal is to fit a Gaussian curve with four parameters. The function is given by:
f(x) = A * exp (-(x - B)*(x - B) / 2*C*C) + D
The goal is to find the values of A, B, C & D that best fit the data. In terms of the model, A = param[0], B = param[1], C = param[2] and D = param[3].
|
inline |
Create the cost function. Here the experimental data must be passed in, and cannot be changed (if you want to, just create another cost function object). Here the experimental data is two vectors, the independent variable (x), and the dependent variable (y).
Intended use : GaussianEquation cost_func(data_x, data_y);
| data_x | A vector of independent variable values |
| data_y | A vector of experimental observations |
|
inlinevirtual |
Calculate the linear distance (residuals) between our model and the data. This method encapsulates the model, and expects the current estimates of the unknown parameters as an input. See the class documentation for details about the model.
Intended use : residuals = cost_func(param)
| param | A vector containing the current estimates of the parameters we are trying to fit |
Implements Unfit::GenericCostFunction.
|
private |
A vector to store the experimental x values
|
private |
A vector to store the experimental observations y
1.8.13