vec_math
Class HarmonicFit.HarmonicModel

java.lang.Object
  extended by vec_math.AbstractDataModel
      extended by vec_math.AbstractGradientModel
          extended by vec_math.HarmonicFit.HarmonicModel
All Implemented Interfaces:
DataModel, GradientModel
Enclosing class:
HarmonicFit

private static class HarmonicFit.HarmonicModel
extends AbstractGradientModel

Our data model.


Nested Class Summary
 
Nested classes/interfaces inherited from class vec_math.AbstractDataModel
AbstractDataModel.Construct, AbstractDataModel.LocalM
 
Field Summary
(package private)  double external
          Square of external error.
(package private)  boolean fitting
          If true, we return the almost-linear model for LM-fitting.
 
Fields inherited from class vec_math.AbstractDataModel
sigma, x, y
 
Constructor Summary
protected HarmonicFit.HarmonicModel(VectorG[] times, double[] y, double[] err, double ext2)
           
 
Method Summary
 double evaluateModel(VectorG tup4, VectorG x1)
          The model parameters are per index 0: frequency f = 1/P; ω=2πf 1: cosine amplitude 2: sine amplitude 3: constant offset
 Matrix getGradientMatrix(VectorG tup4)
          The gradient matrix of the model holds per column index 0: d/df frequency f = 1/P; ω=2πf.
 double[] getMeasurementErrors()
          If we had an external error, we subtract it again.
 int getParameterCount()
          The number of model parameters should be less than the number of data points in the model, otherwise you fit a underdetermined problem.
 void setFitting(boolean fit)
          Toggle the fitting flag.
 
Methods inherited from class vec_math.AbstractGradientModel
check, check, getNegativeChi2HalfGradient, getNegativeChi2HalfGradient, getPseudoHessian, getPseudoHessian, LevenbergMarquardtSolver
 
Methods inherited from class vec_math.AbstractDataModel
getChiSquareModel, getChiSquareModel, getLorentzianModel, getMeasureCount, getMeasures, getModel, getModel, getResiduals, getResiduals, getRms, getRobustModel, getTimes, getTotalErrors, LorentzianSolver, RobustSolver, SimplexSolver
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface vec_math.DataModel
getMeasureCount, getMeasures, getModel, getResiduals, getTimes, getTotalErrors
 

Field Detail

external

double external
Square of external error.


fitting

boolean fitting
If true, we return the almost-linear model for LM-fitting.

Constructor Detail

HarmonicFit.HarmonicModel

protected HarmonicFit.HarmonicModel(VectorG[] times,
                                    double[] y,
                                    double[] err,
                                    double ext2)
Method Detail

getParameterCount

public int getParameterCount()
Description copied from interface: DataModel
The number of model parameters should be less than the number of data points in the model, otherwise you fit a underdetermined problem.

Returns:
The number of parameters in the model. This equals the dimension of the input vector in DataModel.getModel(vec_math.VectorG).

setFitting

public void setFitting(boolean fit)
Toggle the fitting flag. During minimization with Levenberg- Marquardt or Simplex, this should be set to true. After the final solution has been converted to the human-readable form, set this to false to get correct model data.


evaluateModel

public double evaluateModel(VectorG tup4,
                            VectorG x1)
The model parameters are per index

Parameters:
x1 - 1-d vector holding the time.
tup4 - The model parameters

getMeasurementErrors

public double[] getMeasurementErrors()
If we had an external error, we subtract it again.

Specified by:
getMeasurementErrors in interface DataModel
Overrides:
getMeasurementErrors in class AbstractDataModel

getGradientMatrix

public Matrix getGradientMatrix(VectorG tup4)
The gradient matrix of the model holds per column index