Initial parameter values, constraints, and solver settings

Set up a nonlinear problem reproducibly: try a curve manually, set admissible ranges for the parameters and tell a free coefficient from a fixed one.

Reference interface: GX-TXT DEV112-P011 · Dataset Curve Fit.

The role of the initial parameters

Many nonlinear fitting problems need a vector of starting parameters. Unlike a direct linear regression, an iterative algorithm explores the coefficient space and can reach different solutions depending on the initialization, the constraints and the shape of the objective function.

Consider a Gaussian peak with constant offset, represented by:

U(t) = a · exp[−½((t − μ)/σ)²] + c.

The amplitude a and the offset c are in volts; the center μ and the width σ in seconds. As an example we use 21 synthetic observations between 0 and 10 s, in the Dataset c10_gaussian_bounds.

From the plot you can estimate a maximum near 5 s, an amplitude of about 1.7 V above the background and a width of the order of 1–2 s. A plausible starting choice is 1.55,4.8,1.25,0.1, in the amplitude, center, width, offset order.

Figure 1. Configuring the four initial parameters. They are starting values for the numerical method, not final estimates.

View the manual curve before fitting

With the source loaded, open Fit → Models and fitting → Initial parameters and manual curve…. The window shows the name of each coefficient, its value and any allowed limits.

You can edit the fields to see how the model shape would change. The main commands are Suggest initials, to request an automatic proposal; Evaluate now, to calculate the curve with the current values; and Apply initial values, to copy these values into the regression configuration.

Figure 2. The Gaussian parameter editor. The center value can be read directly instead of being inferred only from the shape of the curve.

The manual curve is drawn as a dashed purple line. It is used to judge the plausibility of the chosen coefficients, while the actual regression is calculated only when you request a Preview.

Figure 3. Manual curve from the initial parameters. It helps you check center, height, width and offset before the optimization.

After checking the values, select Apply initial values and request Preview fit. The model is fitted to the data and the fitted curve takes the coefficients found by the solver.

Figure 4. Gaussian regression with all coefficients free. The center moves from the initial 4.8 s to about 5.0 s to fit the observations.

Open and configure Solver settings

The Fit → Models and fitting → Solver settings… menu opens the numerical configuration of nonlinear models. The settings depend on the method and the model used.

The panel lets you choose the solver, the trust-region strategy, the loss function, the maximum number of iterations, the maximum calculation time and the stopping tolerances. It also includes multi-start options and the parameter bound vectors.

Figure 5. Basic settings of the nonlinear solver. The tolerances define numerical stopping criteria, not the physical accuracy of the source data.

With linear loss, the solver minimizes an ordinary sum of squared residuals. Robust alternatives such as huber or cauchychange how large residuals are treated and should be chosen from deliberate assumptions about the data, not just to raise R².

In the example we use Solver = auto, Trust-region strategy = levenberg_marquardt, Residual loss = linear, Starting strategy = single, a maximum of 1,800 iterations and 120 seconds. The tolerances stay at the initial values shown by the Viewer.

Set lower and upper bounds

Bounds constrain the admissible values of the coefficients. They are useful when knowledge of the system requires, for example, a positive width or a center within a given time interval.

The Lower bounds and Upper bounds fields accept a vector of space-separated values in the canonical parameter order. For the Gaussian in the example:

ParameterLower boundUpper boundUnit
Amplitude0.53.0V
Center4.06.0s
Width0.73.0s
Offset0.00.5V

Enter 0.5 4 0.7 0 as the lower bounds and 3 6 3 0.5 as the upper bounds. Each vector must contain exactly four values, one per coefficient. The numbers must be consistent with the declared physical units.

To leave all parameters free within the ranges, use Fixed parameters = 0 0 0 0.

Figure 6. The bounds and the fixed-parameter vector in the same window. The 1 value in the second position fixes the center; the 0 value leaves a coefficient free.

With all parameters free, the regression with these bounds gives the same result as the previous one, because the optimal estimates lie inside the chosen ranges.

Figure 7. A parameter bound does not change the solution automatically when the numerical minimum already lies inside the admissible domain.

Fix a parameter and assess the consequences

The Fixed parameters field uses a binary mask: 0 means free parameter and 1 means a parameter held at its initial value. In the order amplitude, center, width, offset order, the 0 1 0 0 vector fixes the peak center.

If the initial center is 4.8 s, the solver can no longer move it to about 5 s, even if that would improve the agreement with the observations. The other three coefficients remain free.

Figure 8. The center is held at 4.8 s and marked as fixed. Its standard error is indicated as not_applicable because it was not estimated as a free parameter.

The comparison makes the effect of the constraints visible:

ConfigurationCenter (s)RMSE (V)R²
Four free parameters4.9999580.0028680.999977
Four free parameters with bounds4.9999580.0028680.999977
Center fixed at 4.8 s4.8000000.0830870.980850

With the center fixed, the RMSE is about 29 times greater than in the regression with all coefficients free. This does not mean that fixing a parameter is always wrong: it can be necessary when a quantity is known from an independent measurement or a physical constraint. It means that the fixed value needs a scientific justification.

Check the effect of constraints numerically

For a reproducible comparison, the three fitting problems were also solved with an independent nonlinear least-squares algorithm, using the same data and constraints. The estimates and indicators are consistent with those shown by Curve Fitter within numerical tolerances.

For each configuration, keep track of the number of observations, the number of free parameters and the restrictions actually applied. A fixed parameter does not count toward the model degrees of freedom in the same way as an estimated coefficient.

Numerical bounds can prevent physically meaningless results, but they do not correct a wrong choice of function. Even with valid constraints, you must look at the residuals and decide whether the model adequately represents the phenomenon.

A practical procedure for setting up the fit

Start from the shape of the data and the units of the variables; assign plausible initial values for the chosen function and use the manual curve to check its position and shape. Then define bounds only when external knowledge justifies them, choose a loss consistent with the analysis and request the Preview. Compare the final parameters with the admissible ranges and check the pattern of the residuals.

In particular, if a coefficient lands exactly on a bound, this may signal that the unconstrained minimum lies outside the range or that the problem is poorly identifiable. Checking scientific plausibility remains necessary even when the program reports that the numerical stopping criteria were met.