17using namespace CurveFitting;
19using namespace Kernel;
26 declareParameter(
"A1", 0.0,
"the limit of the function as x tends to zero");
27 declareParameter(
"A2", 0.1,
"the limit of the function as x tends to infinity");
28 declareParameter(
"Midpoint", 100.0,
"Sigmoid Midpoint");
29 declareParameter(
"GrowthRate", 1.0,
"Growth rate");
38 for (
size_t i = 0; i < nData; i++) {
39 out[i] = a2 + (a1 - a2) / (exp((xValues[i] - midpoint) / gr) + 1);
49 for (
size_t i = 0; i < nData; i++) {
50 double expFunc = exp((xValues[i] - midpoint) / gr);
51 double denominatorSq = pow((expFunc + 1), 2);
53 double diffa1 = 1 / (expFunc + 1);
54 double diffa2 = 1 - diffa1;
55 double diffmidpoint = ((a1 - a2) * expFunc) / (gr * denominatorSq);
56 double diffgr = ((a1 - a2) * (xValues[i] - midpoint) * expFunc) / (pow(gr, 2) * denominatorSq);
58 out->
set(i, 0, diffa1);
59 out->
set(i, 1, diffa2);
60 out->
set(i, 2, diffmidpoint);
61 out->
set(i, 3, diffgr);
#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.
double getParameter(size_t i) const override
Get i-th parameter.
Provide Smooth Transition function interface to IFunction.
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.