public class HarmonicFitter extends AbstractCurveFitter
Harmonic fitting is a very simple case of curve fitting. The
estimated coefficients are the amplitude a, the pulsation omega and
the phase phi: f (t) = a cos (omega t + phi). They are
searched by a least square estimator initialized with a rough guess
based on integrals.
This class
AbstractCurveFitter.FitMeasurementcoefficients, measurements| Constructor and Description |
|---|
HarmonicFitter(EstimatedParameter[] coefficients,
Estimator estimator)
Simple constructor.
|
HarmonicFitter(EstimatedParameter[] coefficients,
int maxIterations,
double convergence,
double steadyStateThreshold,
double epsilon)
Deprecated.
replaced by
HarmonicFitter(EstimatedParameter[],
Estimator) as of version 7.0 |
HarmonicFitter(Estimator estimator)
Simple constructor.
|
HarmonicFitter(int maxIterations,
double convergence,
double steadyStateThreshold,
double epsilon)
Deprecated.
replaced by
HarmonicFitter(Estimator)
as of version 7.0 |
| Modifier and Type | Method and Description |
|---|---|
double[] |
fit()
Perform the fitting.
|
double |
getAmplitude()
Get the current amplitude coefficient estimate.
|
double |
getPhase()
Get the current phase coefficient estimate.
|
double |
getPulsation()
Get the current pulsation coefficient estimate.
|
double |
partial(double x,
EstimatedParameter p)
Get the derivative of the function at x with respect to parameter p.
|
double |
valueAt(double x)
Get the value of the function at x according to the current parameters value.
|
addWeightedPair, getAllParameters, getMeasurements, getUnboundParameters, sortMeasurementspublic HarmonicFitter(Estimator estimator)
estimator - estimator to use for the fittingpublic HarmonicFitter(EstimatedParameter[] coefficients, Estimator estimator)
This constructor can be used when a first estimate of the coefficients is already known.
coefficients - first estimate of the coefficients.
A reference to this array is hold by the newly created
object. Its elements will be adjusted during the fitting process
and they will be set to the adjusted coefficients at the end.estimator - estimator to use for the fittingpublic HarmonicFitter(int maxIterations,
double convergence,
double steadyStateThreshold,
double epsilon)
HarmonicFitter(Estimator)
as of version 7.0maxIterations - maximum number of iterations allowedconvergence - criterion threshold below which we do not need
to improve the criterion anymoresteadyStateThreshold - steady state detection threshold, the
problem has reached a steady state (read converged) if
Math.abs (Jn - Jn-1) < Jn * convergence, where
Jn and Jn-1 are the current and
preceding criterion value (square sum of the weighted residuals
of considered measurements).epsilon - threshold under which the matrix of the linearized
problem is considered singular (see SquareMatrix.solve).public HarmonicFitter(EstimatedParameter[] coefficients, int maxIterations, double convergence, double steadyStateThreshold, double epsilon)
HarmonicFitter(EstimatedParameter[],
Estimator) as of version 7.0This constructor can be used when a first estimate of the coefficients is already known.
coefficients - first estimate of the coefficients.
A reference to this array is hold by the newly created
object. Its elements will be adjusted during the fitting process
and they will be set to the adjusted coefficients at the end.maxIterations - maximum number of iterations allowedconvergence - criterion threshold below which we do not need
to improve the criterion anymoresteadyStateThreshold - steady state detection threshold, the
problem has reached a steady state (read converged) if
Math.abs (Jn - Jn-1) < Jn * convergence, where
Jn and Jn-1 are the current and
preceding criterion value (square sum of the weighted residuals
of considered measurements).epsilon - threshold under which the matrix of the linearized
problem is considered singular (see SquareMatrix.solve).public double[] fit()
throws EstimationException
AbstractCurveFitterThis method compute the coefficients of the curve that best
fit the sample of weighted pairs previously given through calls
to the addWeightedPair method.
fit in class AbstractCurveFitterEstimationException - if the fitting is not possible
(for example if the sample has to few independant points)public double getAmplitude()
f (t) = a cos (omega t + phi)public double getPulsation()
f (t) = a cos (omega t + phi)public double getPhase()
f (t) = a cos (omega t + phi)public double valueAt(double x)
valueAt in class AbstractCurveFitterx - abscissa at which the theoretical value is requestedpublic double partial(double x,
EstimatedParameter p)
partial in class AbstractCurveFitterx - abscissa at which the partial derivative is requestedp - parameter with respect to which the derivative is requestedCopyright © 2001-2007 Luc Maisonobe. All Rights Reserved.