This is machine translation

Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Translate This Page

MathWorks Machine Translation

The automated translation of this page is provided by a general purpose third party translator tool.

MathWorks does not warrant, and disclaims all liability for, the accuracy, suitability, or fitness for purpose of the translation.

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

y(x)=ae−bx+a1e−(x−b1c1)2+a2e−(x−b2c2)2

where ai are the peak
amplitudes, bi are the peak
centroids, and ci are 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 Fitting app:

load gauss3
cftool

The workspace contains two new variables:

xpeak is a vector of predictor
values.

ypeak is a vector of response values.

In the Curve Fitting app, select xpeak for X
data and ypeak for Y data.

Enter Gauss2exp1 for the Fit
name.

Select Custom Equation for
the model type.

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, constrain a1, a2, c1,
and c2 to be greater than
0.

Click Fit Options.

Change the Lower bound for a1, a2, c1,
and c2 to 0,
as the peak amplitudes and widths cannot be negative.

Enter start points as shown for the unknown coefficients.

Unknowns

Start
Point

a

100

a1

100

a2

80

b

0.1

b1

110

b2

140

c1

20

c2

20

As you change fit options, the Curve Fitting app refits. Press Enter or
close the Fit Options dialog box to ensure your last change is applied
to the fit.

Following are the fit and residuals.

Was this topic helpful?

Select Your Country

Choose your country to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .