MathGrapher | The Mathematical Graphing Tool for Students, Scientists and Engineers


  • Functions
  • Data
  • Curve Fitting
  • >
  • Iterations
  • ODEs
  • Matrices
  • L-systems
  • Game of life
  • Screenviews
  • Curve fitting (linear and nonlinear)
    You are here: Modules > Curve Fitting
    Links in the text refer to the lower part of the page

    Curve fitting (linear and non-linear)

    A number of least squares curve fitting methods can be selected:

    Levenberg-Marquardt (non-linear) Curve Fitting

    The example given below illustrates a fit to data from a Fermi distribution:

    This example is made in the following steps

    • The Function was defined and drawn for constant values: a=4, b=0.5, c=2

    • Data points were read into the data grid by clicking on the graph (after pushing the "Read data from the graph" button in the Extra tab on the Data panel)

    • Go back to the Function panel and select the constants (in this case a, b and c) for which you want to find a least squares solution to the data. Give them an appropriate initial value.
      Note that you may select more than one constant by using the Ctrl or Shift Button.

    • Select the Data from the Data grid and plot them

    • Finally open the Curve Fitting panel, select Levenberg-Marquardt and press Go. The resulting solution is
      drawn in the graph and the results together with some statistics of the residuals are shown in the Results window.

    • Check to see if the original values of a and b and c are retrieved!!

      Non-continuous functions or complicated periodic functions are difficult to fit. Such functions require
      special fitting algorithms. As an experiment define and plot the singular function 1/(x+b) for b = - 5 in
      the interval [0,10]. Read some points from the graph and try to find a fit with Levenberg-Marquardt.
      Then try to fit it with the 4th or 5th entry in the Curve Fitting list box.

      © MathGrapher 2006 | Freeware since 25 october 2013   Contact the Webmaster