Sum of two Gaussians

I wrote a program that will open up a file and fit the data to a gaussian peak. Some of the new data we're collecting has 2 peaks and I would like to know how to fit a gaussian to each peak. Each of these files contains a large amount of frames, so I want it to be automatic. I already have the code in place to fit a gaussian to each frame and load the coefficients into a separate wave for storage. I just need to know how to code for the 2 gaussian fits. Thanks.
You could fit to the sum of two gaussian peaks.

See the documentation that accompanies the Multi-peak Fit Example experiment.

Follow the File->Example Experiments->Curve Fitting->Multi-peak Fit menus.

Fitting to the sum of two gaussian peaks is a special kind of user-defined fitting function used with the FuncFit operation.

Software Engineer, WaveMetrics, Inc.
English_Lab wrote:
I wrote a program that will open up a file and fit the data to a gaussian peak. Some of the new data we're collecting has 2 peaks and I would like to know how to fit a gaussian to each peak. Each of these files contains a large amount of frames, so I want it to be automatic. I already have the code in place to fit a gaussian to each frame and load the coefficients into a separate wave for storage. I just need to know how to code for the 2 gaussian fits. Thanks.


Jim's answer is correct.

In version 6, there is another possibility- you can actually fit a sum of fitting functions without having to write the summed function yourself. Read about this feature by executing this command on Igor's command line:

DisplayHelpTopic "Fitting Sums of Fit Functions"

It is easier to let the Multipeak Fit package do the summing, etc., for you, though. In 6.0 and before it is quite difficult to do batch fitting with Multipeak Fit. With the 6.1 beta, you get a beta version of Multi-peak Fit 2, which includes a couple of functions to help Igor programmers do batch fitting.

To download the beta:

http://www.wavemetrics.net/Updaters/AboutPublicBetaVersions.html

Once you have downloaded the beta and installed it, go to the File menu and select Example Experiments->Curve Fitting->Multi-peak Fit 2 Demo.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com