Gaussian Fitting with an Exponential Background
This example fits two poorly resolved Gaussian peaks on a decaying exponential background using a general (nonlinear) custom model.
Fit the data using this equation
whereaiare the peak amplitudes,biare the peak centroids, andciare related to the peak widths. Because unknown coefficients are part of the exponential function arguments, the equation is nonlinear.
Load the data and open the Curve Fitter app.
loadgauss3curveFitter
The workspace contains two new variables:
xpeak
is a vector of predictor values.ypeak
is a vector of response values.
In the Curve Fitter app, on theCurve Fittertab, in theData部分中,点击Select Data. In the Select Fitting Data dialog box, select
xpeak
as theX Datavalue andypeak
as theY Datavalue. EnterGauss2exp1
as theFit namevalue.On theCurve Fittertab, in theFit Type部分中,点击the arrow to open the gallery. In the fit gallery, clickCustom Equationin theCustomgroup.
In theFit Optionspane, replace the example text in the equation edit box with these terms:
a*exp(-b*x) + a1*exp(-((x-b1)/c1)^2) + a2*exp(-((x-b2)/c2)^2)
The fit is poor (or incomplete) at this point because the starting points are randomly selected and no coefficients have bounds.
Specify reasonable coefficient starting points and constraints. Deducing the starting points is particularly easy for the current model because the Gaussian coefficients have a straightforward interpretation and the exponential background is well defined. Additionally, as the peak amplitudes and widths cannot be negative, constraina1,a2,c1, andc2to be greater than 0.
In theFit Optionspane, clickAdvanced Options.
In theCoefficient Constraintstable, change theLowerbound fora1,a2,c1, andc2to
0
, as the peak amplitudes and widths cannot be negative.Enter theStartPointvalues as shown for the specified coefficients.
Coefficients Start Point a
100 a1
100 a2
80 b
0.1 b1
110 b2
140 c1
20 c2
20 As you change the fit options, the Curve Fitter app updates the fit.
Observe the fit and residuals plots. To create a residuals plot, clickResiduals Plotin theVisualizationsection of theCurve Fittertab.