net.grelf
Class Fitter_

java.lang.Object
  extended by net.grelf.Fitter_
All Implemented Interfaces:
Fitter

public class Fitter_
extends java.lang.Object
implements Fitter

Fits data to particular curves.


Constructor Summary
Fitter_()
           
 
Method Summary
 double getC()
          Get the intercept of the fitted straight line, as in y = Mx + c
 double getChiSq()
          Get the chi-squared fitting factor.
 double getM()
          Get the slope of the fitted straight line, as in y = Mx + C
 double getQ()
          Get quality factor Q.
 double getSigmaC()
          Get the standard deviation of the intercept of the fitted line.
 double getSigmaM()
          Get the standard deviation of the slope of the fitted line.
 boolean isFitted()
           
 void leastSquaresStraightLine(double[] x, double[] y, double[] sigmaY)
          Fit a straight line y = mx + c to the given data points by the least squares method.
 double x(double y)
          Calculate the inverse: x for given y, using the fitted parameters, x = (y - c) / m.
 double y(double x)
          Calculate y for given x, using the fitted parameters, y = mx + c.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Fitter_

public Fitter_()
Method Detail

isFitted

public boolean isFitted()
Specified by:
isFitted in interface Fitter

getM

public double getM()
Description copied from interface: Fitter
Get the slope of the fitted straight line, as in y = Mx + C

Specified by:
getM in interface Fitter

getC

public double getC()
Description copied from interface: Fitter
Get the intercept of the fitted straight line, as in y = Mx + c

Specified by:
getC in interface Fitter

getSigmaM

public double getSigmaM()
Description copied from interface: Fitter
Get the standard deviation of the slope of the fitted line.

Specified by:
getSigmaM in interface Fitter

getSigmaC

public double getSigmaC()
Description copied from interface: Fitter
Get the standard deviation of the intercept of the fitted line.

Specified by:
getSigmaC in interface Fitter

getChiSq

public double getChiSq()
Description copied from interface: Fitter
Get the chi-squared fitting factor.

Specified by:
getChiSq in interface Fitter

getQ

public double getQ()
Description copied from interface: Fitter
Get quality factor Q.

Specified by:
getQ in interface Fitter

leastSquaresStraightLine

public void leastSquaresStraightLine(double[] x,
                                     double[] y,
                                     double[] sigmaY)
Fit a straight line y = mx + c to the given data points by the least squares method. The two arrays must be of the same length and that is the number of data points. After fitting the results are obtainable via the other methods of this class. The third parameter is a further array of the same length containing kown standard deviations of the measured values y, as weighting factors. If sigmaY is null all points are given equal weight.

Specified by:
leastSquaresStraightLine in interface Fitter

y

public double y(double x)
Calculate y for given x, using the fitted parameters, y = mx + c. Returns 0.0 if not fitted.

Specified by:
y in interface Fitter

x

public double x(double y)
Calculate the inverse: x for given y, using the fitted parameters, x = (y - c) / m. Returns 0.0 if not fitted.

Specified by:
x in interface Fitter