Nonlinear Curve Fitting



Nonlinear curve fitting is applied when linear (linearized) function cannot fit the data well or particular function is specified in advance. If the distribution of the data is S-shaped or tempe bell shaped, linear (linearized) function cannot match them.
After selecting the target data series, define the empirical function. If you have registered function(s), you can select one of them by clicking the [V] button at the rightmost of the edit box (combo box).
[Syntax of expression]
Up to seven parameters can be optimized. The name of a parameter consists of less than 10 letters (alphabet, numerals, and underscore) and must start with alphabet.
The Lebenberg-Marquadt nonlinear least square method is used in the optimization.
Because parameter values are iterally optimized, you have to set initial values and the values are important to reach global minimum repidly.
On exiting focus from the edit box by moving cursor to other control using mouse or [Tab] key, parameters are listed in the first column of the table in the order of appearance. Input the initial values into the next column for each parameters.

[Replace]
Fixed : Checked parameters are not optimized but fixed at the value.
Iteration :
Since the criteria of convergence is rather strictly set, it can take much time to attain convergence. To prevent such a case, maximum iteration times should be specified. Generally, the default value of 1000 is satisfactory.

In some cases when initial values are not close to their optimum values, the resulted "optimum" values may be those that give local minimum objective function (to be minimized) although the data can be fitted with the function well. If you cannot guess the initial values, the following procedure is recommended:
  1. Input mathematically allowable value (e.g. x must be positive for ln(x), and draw the function by clicking [View] button.
  2. Call the curve fitting dialog box again by double-clicking the shown curve. If no curve appears on the current plot domain, try the above step again by selecting the curve in the [List of Data Series] under the [Edit] menu.( Do not select [Insert] - [Curve] - [Nonlinear...])
  3. Try fitting while restricting the number of simultaneously optimized parameters two. When XYGrapher asks you whether you let it copy the (temporaly) optimized values to the table, select [Yes].
  4. Increase the number of simultaneously optimized parameters one by one. And try fitting again.

Copy / Paste
You can copy and paste a function (curve) with the properties.
1. Click [Copy] button
2. Close the fitting dialog box.
3. Call the fitting dialog box again (i.e. create a new fitting curve)
   by selecting [Insert] -> [Curve] -> [Nonlinear...].
4. Click [Paste] button.