Unfit  3.1.1
Data fitting and optimization software
Public Member Functions | Private Attributes | List of all members
Unfit::Examples::Osborne Class Reference

Fit a double exponential to experimental data. More...

#include <Osborne.hpp>

Inheritance diagram for Unfit::Examples::Osborne:
Unfit::GenericCostFunction

Public Member Functions

 Osborne (const std::vector< double > &x)
 
std::vector< double > operator() (const std::vector< double > &param)
 
- Public Member Functions inherited from Unfit::GenericCostFunction
virtual ~GenericCostFunction ()
 

Private Attributes

const std::vector< double > x_
 

Detailed Description

Fit a double exponential to experimental data.

Here the goal is to find a parameter set that best fits the following function to the experimental data:

f(t) = A + B*exp(-D*t) + C*exp(-E*t)

The goal is to find the values of A, B, C, D & E that gives a best fit. In terms of the model, A = param[0], B = param[1], C = param[2], D = param[3], and E = param[4].

Constructor & Destructor Documentation

◆ Osborne()

Unfit::Examples::Osborne::Osborne ( const std::vector< double > &  x)
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 of data.

Intended use : Osborne cost_func(x);

Parameters
xA vector of experimental data

Member Function Documentation

◆ operator()()

std::vector<double> Unfit::Examples::Osborne::operator() ( const std::vector< double > &  param)
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)

Parameters
paramA vector containing the current estimates of the parameters we are trying to fit
Returns
A vector containing the residuals

Implements Unfit::GenericCostFunction.

Member Data Documentation

◆ x_

const std::vector<double> Unfit::Examples::Osborne::x_
private

A vector to store the experimental data x


The documentation for this class was generated from the following file: