|
Unfit
3.1.1
Data fitting and optimization software
|
Fit a two parameter first order ordinary differential equation (ODE) More...
#include <ODE2D.hpp>
Public Member Functions | |
| ODE2D (const std::vector< double > &x, double dt) | |
| std::vector< double > | operator() (const std::vector< double > ¶m) |
Public Member Functions inherited from Unfit::GenericCostFunction | |
| virtual | ~GenericCostFunction () |
Private Attributes | |
| const std::vector< double > | x_ |
| const double | dt_ |
Fit a two parameter first order ordinary differential equation (ODE)
This is an example data fitting problem with two parameters for a single first order ordinary differential equation (ODE). Here the goal is to fit the following ODE to some experimental data:
dx/dt = Ax + B
The goal is to find the values of A & B that best fit the data. In terms of the model, A = param[0] and B = param[1].
|
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 a vector, and we also require the time step between observations.
Intended use : ODE2D cost_func(x, dt);
| x | A vector of experimental data |
| dt | The time step between 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 |
The time step between observations
|
private |
A vector to store the experimental data x
1.8.13