Don,
Just wanted to clarify the termination criteria for the nonlinear curve fitting routines. There are two criteria used to terminate the fitting process:
"max iteration" and "tolerance". The main while loop terminates when either of these conditions is met, so:
IF( (current_iteration > max_iteration) OR (current_tolerance <= tolerance) ) THEN (terminate loop)
"current iteration" is just the current loop counter(starts at 1 for the first iteration). This term is mainly a guard against having the fitting process run too long.
tolerance is computed as the relative change between the current and previous weighted least squares values.
Let wls = SUM_OVER_ALL_X( weight(x)*(f(x,a)-data(x))^2 )
current_tolerance = ABS(current_wls - previous_wls)/(ABS(current_wls) + machine_epsilon)
where ABS indicates absolute value. Adding machine_epsilon to the denominator is just a guard against division by zero.
For the bound nonlinear curve fit VIs, if the "method" input is chosen to be LAR or bi-square, then wls is defined as:
wls = SUM_OVER_ALL_X( weight(x)*reweight(x)*(f(x,a)-data(x))^2 )
where reweight(x) is a term reducing the weight of high-leverage data points.
For both the constrained and unconstrained fitting routines, if the weight input is unwired then all points are considered to have a weight of 1.
Christian has nicely covered the difference between the number of iterations and the number of function calls. If your
When the fitting process terminates the best result obtained so far is returned. As you noted, this may be a good result, although the algorithm may not have completely converged yet.
-Jim