Curve Fit


The Curve Fit command is used to fit a function to all or part of your graph. You can enter or select an equation with up to six adjustable parameters.  Curve Fit is available either by clicking the Curve Fit button on the toolbar or by selecting it from the Analyze Menu.

A tutorial covering curve fitting is available. Select Open from the File menu, then look in the Experiments folder to access it.

Draft Graph

You can fit a function either to the whole graph or just to a region of interest. To select a portion of the graph, drag the mouse across the desired region. After selecting Try Fit, the curve fit will be displayed on the graph in the curve fit dialog. You can select a region within that graph, zoom in, etc., and the fit you perform will be applied to your actual graph.


Options

    Fit Type

    Select which type of curve fit you would like to perform: Automatic or Manual.

Note: if Automatic Fit Type is disabled, then "Allow Automatic Curve Fit" is not enabled in the Preferences dialog. To allow automatic fits, check the box in Preferences.

The Create Calculated Column option will create a column in the data table holding the y-values of the fitted function at each value for the X-Axis. Selecting this option will call up display options. You can choose to have the new column plotted on the graph and/or have the curve fit helper object displayed on the graph.

Once a calculated column has been plotted on the graph, you can adjust the variables by adding a Parameter Control from the Insert menu.


General Equation

Here you select an equation to be fit to the data. You can either choose a formula from the list in the scrolling box, or you can click the Define Function button and type a formula in the text box. Many common functions, such as linear, exponential, inverse, and polynomial are included in the list.

The Degree/Power box is activated and available for editing when the appropriate general equation is selected, e.g. A*x^n (Variable Power).


Offset (t0)

When Offset (t0) is checked, the "t" variable in the equation will change to "(t-t0)" as displayed under Coefficients. This allows you to specify a different t0 for the fit equation based on the left edge of the currently selection region.  

User Defined Functions


You can define and add customized mathematical functions to the general equation list. Up to six parameters can be used in the equation; each parameter can occur only once in the expression. Click the Define Function button and type in the function in the box. Delete added functions and equations from the list by highlighting and clicking the Delete Function button. If you must use an expression that contains repeated terms, use the model feature instead of the automatic curve fit.



Gaussian Curve Fits

The Gaussian distribution function (also known as the Normal distribution) is available among the various curve fit equations. The Normalized Gaussian function (with an integrated area of one) is

Normal

in which µ and σ >0 are the mean
and standard deviation

The normalized function will only fit data well if the data are normalized to an area of one.

If non-normalized data are used, select the Gaussian function, which fits to any area, as well as including a constant offset. Frequently nuclear radiation counting statistics will require the non-normalized Gaussian function.


Coefficients*

The coefficients can be adjusted individually to improve the fit of the function to the data. Either type in a new value, or use the up and down arrow buttons to step the value of the parameter up and down. 

Depending on the coefficients initially chosen, a function may not fall within the graph window. In this case it may be difficult to adjust the coefficients to achieve a good fit. You may want to calculate the necessary values to force the function to pass through one data point (often the y-intercept) and begin with these values.

Clicking the open triangle  will call up the Set Delta dialog:

The delta dialog lets you enable/disable an automatic calculation for the delta to use when using the spin controls to the right of the coefficients.  If you choose to disable the automatic calculation of the delta, you can type in whatever delta value you like.


After you Click Done, a floating box (helper object) containing the equation and fit coefficients of the function will be added to the graph. Black brackets mark the beginning and end of the range. These can be clicked and dragged to adjust the fit. To remove the fitted line, click the box in the upper left corner of the helper object.

You can adjust the parameters of a manual fit after it has been drawn on the main graph. Click a parameter name in the helper object to select it. An arrow symbol next to the parameter name will appear. Use the up and down cursor keys to raise or lower the value. Use the left and right cursor keys to decrease and increase the step size for changing the value. You can also click the numeric value and type in a new value. The graph will be updated. Click another parameter to change it. Double-clicking the helper object will open its options dialog where you can change all the values at once.

The helper object can be hidden to show just the fitted line. Double click the helper and deselect the "Show On Graph" option. Restore the helper object by choosing Additional Object Options->Reveal Hidden Objects from the Options menu.

Note: For complete details about Curve Fitting, we recommend that you consult Numerical Recipes in C ©. The book in its entirety can be viewed at the following address: http://lib-www.lanl.gov/numerical/bookcpdf.html
 

Toolbar: 
 

See Also:

Curve Fit Options

Model

Automatic Curve Fit

How To/ Curve Fitting


NUMERICAL RECIPES IN C: THE ART OF SCIENTIFIC COMPUTING. Copyright © 1988-92 Cambridge University Press.