Menu

basic_fitting

A. Smith

Basic Fitting: The FitSpec Function

Fitting a spectrum may be done completely within the FitSpec function. FitSpec may either optimize a given peak list by varying position, amplitude, and/or linewidth, or may perform the peak picking as well, with periodic modification of the peak list to optimize the spectrum fit. We will refer to the former case as a fixed peak list and the latter as a dynamic peak list. Additionally, settings controlling the behavior of FitSpec may be determined internally or fitting instructions may be provided by the user. The commands are formatted as follows.

With a dynamic peak list, without any user instructions:

fit=FitSpec(spec);

or with a dynamic peak list, with additional user instructions:

fit=FitSpec(spec,par);

In the first case, the program uses all default options, some of which are calculated during the program run depending on properties determined from the ‘spec’ structure. In the second case, the user determines some of these options, and specifies them in the ‘par’ structure. The 'spec' structure contains the experimental spectrum and frequency axes (in ppm), and also may contain acquisition and processing information for the spectrum. The 'par' structure contains instructions for spectrum fitting. The output structure, 'fit', contains lists of peak positions, linewidths, amplitude, and integral, as well as the calculated spectrum and error spectrum, and information on the analysis of the fit.

With a fixed peak list, without any user instructions:

fit=FitSpec(spec,[],fit0);

or with a fixed peak list, with additional user instructions:

fit=FitSpec(spec,par,fit0);

As before, the ‘par’ structure is optional, but now an initial fit is given in ‘fit0’. 'fit0' has a very similar form as ‘fit’, and one may use the output of another fitting run in the ‘fit0’ argument. ‘fit0’ also may containing additional fields to restrict how variables are changed (fixing parameters or setting ranges on the parameters). Note that when ‘fit0’ is provided, then peak position/linewidth/amplitude are optimized, but by default, the peak list itself is not changed (no peaks added or removed). This can be overridden with user settings in the ‘par’ structure.


Auth0 Logo