16using namespace CurveFitting;
18using namespace Kernel;
25 declareParameter(
"A", 0.2,
"Amplitude at time 0");
26 declareParameter(
"Lambda", 0.2,
"Decay rate");
27 declareParameter(
"Frequency", 0.1,
"Frequency of oscillation");
28 declareParameter(
"Phi", 0.0,
"Phase of oscillation at 0 (in Radians)");
37 for (
size_t i = 0; i < nData; i++) {
38 double x = xValues[i];
39 out[i] = gA0 * exp(-gs *
x) * cos(2 * M_PI * gf *
x + gphi);
49 for (
size_t i = 0; i < nData; i++) {
50 double x = xValues[i];
51 double e = exp(-gs *
x);
52 double c = cos(2 * M_PI * gf *
x + gphi);
53 double s = sin(2 * M_PI * gf *
x + gphi);
54 out->
set(i, 0, e * c);
55 out->
set(i, 1, -gA0 *
x * e * c);
57 -gA0 * e * 2 * M_PI *
x * s);
58 out->
set(i, 3, -gA0 * e * s);
67 double a = fmod(
value, 2 * M_PI);
double value
The value of the point.
#define DECLARE_FUNCTION(classname)
Macro for declaring a new type of function to be used with the FunctionFactory.
Represents the Jacobian in IFitFunction::functionDeriv.
virtual void set(size_t iY, size_t iP, double value)=0
Set a value to a Jacobian matrix element.
void setParameter(size_t, const double &value, bool explicitlySet=true) override
Set i-th parameter.
std::string parameterName(size_t i) const override
Returns the name of parameter i.
double getParameter(size_t i) const override
Get i-th parameter.
Provide oscillating exponential decay function: h*exp(-lambda.x)*(cos(2pi*f*x+phi))
void setActiveParameter(size_t i, double value) override
Set new value of i-th active parameter.
void function1D(double *out, const double *xValues, const size_t nData) const override
Function you want to fit to.
void functionDeriv1D(API::Jacobian *out, const double *xValues, const size_t nData) override
Derivatives of function with respect to active parameters.