HarmonicCurveFitter (Apache Commons Math 3.6.1 API)

org.apache.commons.math3.fitting

## Class HarmonicCurveFitter

- java.lang.Object
- - org.apache.commons.math3.fitting.AbstractCurveFitter
  - - org.apache.commons.math3.fitting.HarmonicCurveFitter

-     public class HarmonicCurveFitter
      extends AbstractCurveFitter

  Fits points to a `harmonic oscillator` function.
  The `initial guess values` must be passed in the following order:
  - Amplitude
  - Angular frequency
  - phase
  The optimal values will be returned in the same order.
  Since:
    3.3

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `HarmonicCurveFitter.ParameterGuesser` This class guesses harmonic coefficients from a sample.

    - ### Nested classes/interfaces inherited from class org.apache.commons.math3.fitting.AbstractCurveFitter

      `AbstractCurveFitter.TheoreticalValuesFunction`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static HarmonicCurveFitter` | `create()` Creates a default curve fitter.
    `protected LeastSquaresProblem` | `getProblem(Collection<WeightedObservedPoint> observations)` Creates a least squares problem corresponding to the appropriate curve.
    `HarmonicCurveFitter` | `withMaxIterations(int newMaxIter)` Configure the maximum number of iterations.
    `HarmonicCurveFitter` | `withStartPoint(double[] newStart)` Configure the start point (initial guess).

    - ### Methods inherited from class org.apache.commons.math3.fitting.AbstractCurveFitter

      `fit, getOptimizer`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### create

          public static HarmonicCurveFitter create()

      Creates a default curve fitter. The initial guess for the parameters will be `HarmonicCurveFitter.ParameterGuesser` computed automatically, and the maximum number of iterations of the optimization algorithm is set to `Integer.MAX_VALUE`.
      Returns:
        a curve fitter.
      See Also:
        `withStartPoint(double[])`, `withMaxIterations(int)`

    - #### withStartPoint

          public HarmonicCurveFitter withStartPoint(double[] newStart)

      Configure the start point (initial guess).
      Parameters:
        `newStart` - new start point (initial guess)
      Returns:
        a new instance.

    - #### withMaxIterations

          public HarmonicCurveFitter withMaxIterations(int newMaxIter)

      Configure the maximum number of iterations.
      Parameters:
        `newMaxIter` - maximum number of iterations
      Returns:
        a new instance.

    - #### getProblem

          protected LeastSquaresProblem getProblem(Collection<WeightedObservedPoint> observations)

      Creates a least squares problem corresponding to the appropriate curve.
      Specified by:
        `getProblem` in class `AbstractCurveFitter`
      Parameters:
        `observations` - Sample points.
      Returns:
        the least squares problem to use for fitting the curve to the given `points`.

Copyright © 2003–2016 The Apache Software Foundation. All rights reserved.