Class FitExponential


  • public class FitExponential
    extends NLFittedFunction
    FitExponential -fits an array of points to an exponential of the type y = a0 + a1*exp(a2*x).
    Version:
    0.9
    Author:
    William Gandler
    See Also:
    NLConstrainedEngine
    • Constructor Detail

      • FitExponential

        public FitExponential()
        FitExponential - test constructor, builds and test function.
      • FitExponential

        public FitExponential​(int nPoints,
                              double[] xData,
                              double[] yData)
        FitExponential.
        Parameters:
        nPoints - number of points in the function
        xData - DOCUMENT ME!
        yData - DOCUMENT ME!
      • FitExponential

        public FitExponential​(int nPoints,
                              float[] xData,
                              float[] yData)
        Constructs new fit exponential.
        Parameters:
        nPoints - Number of points in the function
        xData - DOCUMENT ME!
        yData - DOCUMENT ME!
    • Method Detail

      • driver

        public void driver()
        Starts the analysis. For some reason a guess with the wrong sign for a2 will not converge. Therefore, try both sign and take the one with the lowest chi-squared value.
        Overrides:
        driver in class NLConstrainedEngine
      • displayResults

        public void displayResults()
        Display results of displaying exponential fitting parameters.
        Specified by:
        displayResults in class NLFittedFunction
      • fitToFunction

        public void fitToFunction​(double[] a,
                                  double[] residuals,
                                  double[][] covarMat)
        Fit to function - a0 + a1*exp(a2*x).
        Specified by:
        fitToFunction in class NLConstrainedEngine
        Parameters:
        a - The best guess parameter values.
        residuals - ymodel - yData.
        covarMat - The derivative values of y with respect to fitting parameters.
      • testData

        private void testData()
        Test data to test fitting of exponential.
      • generateResiduals

        protected Jama.Matrix generateResiduals()
        Description copied from class: NLFittedFunction
        Calculates the residuals for a given function, not implemented since some functions might prefer to only use a subset of data points, or not use yDataFitted if working during an iteration
        Specified by:
        generateResiduals in class NLFittedFunction
        Returns: