16using namespace CurveFitting;
18using namespace Kernel;
25 declareParameter(
"A", 0.20,
"Amplitude at time 0");
26 declareParameter(
"Sigma", 0.2,
"Decay rate");
27 declareParameter(
"Frequency", 0.1,
"Frequency of oscillation");
28 declareParameter(
"Phi", 0.0,
"Frequency of oscillation");
37 for (
size_t i = 0; i < nData; i++) {
38 double x = xValues[i];
39 out[i] = A * exp(-G * G *
x *
x) * cos(2 * M_PI * gf *
x + gphi);
49 for (
size_t i = 0; i < nData; i++) {
50 double x = xValues[i];
51 double g = exp(-G * G *
x *
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, g * c);
55 out->
set(i, 1, -2 * G *
x *
x * A * g * c);
56 out->
set(i, 2, -A * g * 2 * M_PI *
x * s);
57 out->
set(i, 3, -A * g * s);
68 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 gaussian decay function: A*exp(-(sigma.x)^2))
void functionDeriv1D(API::Jacobian *out, const double *xValues, const size_t nData) override
Derivatives of function with respect to active parameters.
void function1D(double *out, const double *xValues, const size_t nData) const override
Function you want to fit to.
void setActiveParameter(size_t i, double value) override
Set new value of i-th active parameter.