Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.commons.math.optimization.fitting
Class GaussianFunction

    java.lang.Object
      org.apache.commons.math.optimization.fitting.GaussianFunction

All Implemented Interfaces:
  Serializable, DifferentiableUnivariateRealFunction, UnivariateRealFunction

    public class GaussianFunction

extends Object
implements DifferentiableUnivariateRealFunction, 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`

References:

- Wikipedia: Gaussian function

Since:
  2.2
Version:
  $Revision: 1037327 $ $Date: 2010-11-20 21:57:37 +0100 (sam. 20 nov. 2010) $
See Also:
  `GaussianDerivativeFunction`, `ParametricGaussianFunction`, Serialized Form

Field Summary
`private double` | `a` Parameter a of this function.
`private double` | `b` Parameter b of this function.
`private double` | `c` Parameter c of this function.
`private double` | `d` Parameter d of this function.
`private static long` | `serialVersionUID` Serializable version identifier.

Constructor Summary
`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
`UnivariateRealFunction` | `derivative()` Returns the derivative of the function
`double` | `getA()` Gets `a` parameter value.
`double` | `getB()` Gets `b` parameter value.
`double` | `getC()` Gets `c` parameter value.
`double` | `getD()` Gets `d` parameter value.
`double` | `value(double x)` Compute the value for the function.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### serialVersionUID

    private static final long serialVersionUID

  Serializable version identifier.

  See Also:
    Constant Field Values

### a

    private final double a

  Parameter a of this function.

### b

    private final double b

  Parameter b of this function.

### c

    private final double c

  Parameter c of this function.

### d

    private final double d

  Parameter d of this 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 value
    `b` - `b` parameter value
    `c` - `c` parameter value
    `d` - `d` parameter value
  Throws:
    `IllegalArgumentException` - if `d` is 0

### GaussianFunction

    public GaussianFunction(double[] parameters)

  Constructs an instance with the specified parameters.

  Parameters:
    `parameters` - `a`, `b`, `c`, and `d` parameter values
  Throws:
    `IllegalArgumentException` - if `parameters` is null, `parameters` length is not 4, or if `parameters[3]` is 0

Method Detail

### derivative

    public UnivariateRealFunction derivative()

  Returns the derivative of the function

  Specified by:
    `derivative` in interface `DifferentiableUnivariateRealFunction`
  Returns:
    the derivative function

### value

    public double value(double x)

  Compute the value for the function.

  Specified by:
    `value` in interface `UnivariateRealFunction`
  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

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (c) 2003-2013 Apache Software Foundation