C-PLOT

Scientific Graphics and Data Analysis

12.21.4. - Initializing the parameters



The following structure is to be initialized with the parameters you will use in your model equation. The example is for a two-parameter fit to a straight line.
struct init_4 initial[] = {
/* Name         Deriv? Fit? Initial Limit? Low High */
{"Constant term",   1,   1,    0.1,     0,  0,   0},
{"Linear term",     1,   1,    0.9,     0,  0,   0},
};
The number of lines must agree with the number of parameters set by MAXPAR above. The seven elements in each line of the structure are: 1) a character string that identifies the parameter; 2) an integer flag that, if nonzero, indicates your model supplies the analytic derivative of the fitting functions with respect to the corresponding parameter; 3) an integer flag that indicates if this parameter is to be fit initially; 4) the default initial value for this parameter; 5) an integer value indicating whether to constrain the limits -- 1 for the lower limit, 2 for the upper limit and 3 for both; 6) the value of the lower constraint; and 7) the value of the upper constraint. The latter five can be easily changed while the program is running.

Not all parameters you give must be fitted or even used directly in the fitting equation. For instance, a parameter might be put in only to be used for plotting with the fitpar.4 user function (see Appendix C).