public class HarmonicFitter
extends java.lang.Object
Harmonic fitting is a very simple case of curve fitting. The
estimated coefficients are the amplitude a, the pulsation ω and
the phase φ: f (t) = a cos (ω t + φ)
. They are
searched by a least square estimator initialized with a rough guess
based on integrals.
Constructor and Description |
---|
HarmonicFitter(DifferentiableMultivariateVectorialOptimizer optimizer)
Simple constructor.
|
HarmonicFitter(DifferentiableMultivariateVectorialOptimizer optimizer,
double[] initialGuess)
Simple constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addObservedPoint(double weight,
double x,
double y)
Add an observed weighted (x,y) point to the sample.
|
HarmonicFunction |
fit()
Fit an harmonic function to the observed points.
|
public HarmonicFitter(DifferentiableMultivariateVectorialOptimizer optimizer)
optimizer
- optimizer to use for the fittingpublic HarmonicFitter(DifferentiableMultivariateVectorialOptimizer optimizer, double[] initialGuess)
This constructor can be used when a first guess of the coefficients is already known.
optimizer
- optimizer to use for the fittinginitialGuess
- guessed values for amplitude (index 0),
pulsation ω (index 1) and phase φ (index 2)public void addObservedPoint(double weight, double x, double y)
weight
- weight of the observed point in the fitx
- abscissa of the pointy
- observed value of the point at x, after fitting we should
have P(x) as close as possible to this valuepublic HarmonicFunction fit() throws OptimizationException
OptimizationException
- if the sample is too short or if
the first guess cannot be computed"Copyright © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"