Class GaussianFunction
- java.lang.Object
 - 
- org.apache.commons.math.optimization.fitting.GaussianFunction
 
 
- 
- All Implemented Interfaces:
 java.io.Serializable,DifferentiableUnivariateRealFunction,UnivariateRealFunction
public class GaussianFunction extends java.lang.Object implements DifferentiableUnivariateRealFunction, java.io.Serializable
A Gaussian function. Specifically:f(x) = a + b*exp(-((x - c)^2 / (2*d^2)))
Notation key:
- x^n: x raised to the power of n
 - exp(x): e^x
 
- Since:
 - 2.2
 - See Also:
 GaussianDerivativeFunction,ParametricGaussianFunction, Serialized Form
 
- 
- 
Constructor Summary
Constructors Constructor Description GaussianFunction(double[] parameters)Constructs an instance with the specified parameters.GaussianFunction(double a, double b, double c, double d)Constructs an instance with the specified parameters. 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description UnivariateRealFunctionderivative()Returns the derivative of the functiondoublegetA()Gets a parameter value.doublegetB()Gets b parameter value.doublegetC()Gets c parameter value.doublegetD()Gets d parameter value.doublevalue(double x)Compute the value for the function. 
 - 
 
- 
- 
Constructor Detail
- 
GaussianFunction
public GaussianFunction(double a, double b, double c, double d)Constructs an instance with the specified parameters.- Parameters:
 a- a parameter valueb- b parameter valuec- c parameter valued- d parameter value- Throws:
 java.lang.IllegalArgumentException- ifdis 0
 
- 
GaussianFunction
public GaussianFunction(double[] parameters)
Constructs an instance with the specified parameters.- Parameters:
 parameters- a, b, c, and d parameter values- Throws:
 java.lang.IllegalArgumentException- ifparametersis null,parameterslength is not 4, or ifparameters[3]is 0
 
 - 
 
- 
Method Detail
- 
derivative
public UnivariateRealFunction derivative()
Returns the derivative of the function- Specified by:
 derivativein interfaceDifferentiableUnivariateRealFunction- Returns:
 - the derivative function
 
 
- 
value
public double value(double x)
Compute the value for the function.- Specified by:
 valuein interfaceUnivariateRealFunction- Parameters:
 x- the point for which the function value should be computed- Returns:
 - the value
 
 
- 
getA
public double getA()
Gets a parameter value.- Returns:
 - a parameter value
 
 
- 
getB
public double getB()
Gets b parameter value.- Returns:
 - b parameter value
 
 
- 
getC
public double getC()
Gets c parameter value.- Returns:
 - c parameter value
 
 
- 
getD
public double getD()
Gets d parameter value.- Returns:
 - d parameter value
 
 
 - 
 
 -