Curve Fitting

I am trying to fit a data curve so I can find peak values.
I was told by a colleague to fit the data to an "80% Gaussian, 20%Laurenzian" fit.
So far, I am able to fit something to a guassian fit, and to a laurenzian fit, but not a mix of the two.
First of all, is that even mathmatically possible? If so, how do you do it on Igor?
OK, well I think I figured out my first question.
Yes, it is mathmatically feasable, I was misinterpreting the sentance.

What they meant was the following:
y = y value
G(x) = function of Gaussian curve
L(x) = function of Laurenzian curve

I think I need to fit the data to:
y = 0.8*G(x) + 0.2*L(x)

could someone tell me how to do this?
Check out the Multipeakfitting package that comes with the Igor6.1 Beta. (Analysis->Packages->Multipeakfit).

There is only 1 peak per graph,
I would like something more along the lines of "multifunction fitting" if that exists somewhere
OK, well I answered my second question.
I created a new fit called GaussLorMix:

f(x) = 0.8*(y0 + A*exp(-((x-x0)/width)^2)) + 0.2*(y0 + A/((x-x0)^2 + B))

where:
Independent variable = x

Dependent variables:
x0
y0
A
B
width


However, since it is a custom fit, I must provide initial guesses for each of the values.
If I were to provide guesses, they would be exactly that.... guesses

Any advice?

You can manually try out your guesses using the Graph Now button in the Coefficients tab of the Curve Fitting dialog. For details, execute this and read down through the section that mentions Graph Now:

DisplayHelpTopic "Fitting to a User-Defined Function"

Cory K wrote:
OK, well I think I figured out my first question.
Yes, it is mathmatically feasable, I was misinterpreting the sentance.

What they meant was the following:
y = y value
G(x) = function of Gaussian curve
L(x) = function of Laurenzian curve

I think I need to fit the data to:
y = 0.8*G(x) + 0.2*L(x)

could someone tell me how to do this?


You might want to check if your colleague meant that you should fit with a Voigt peak shape, which is a convolution of a Lorenzian peak with a Gaussian peak. The 80/20 split would be a shape parameter of 4, where the shape parameter is the ratio of the Lorenzian width to the Gaussian width.

Igor ships with an XOP called the MultiPeakFit xop that implements a Voigt peak function.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
Cory K wrote:
OK, well I answered my second question.
I created a new fit called GaussLorMix:

f(x) = 0.8*(y0 + A*exp(-((x-x0)/width)^2)) + 0.2*(y0 + A/((x-x0)^2 + B))

where:
Independent variable = x

Dependent variables:
x0
y0
A
B
width


However, since it is a custom fit, I must provide initial guesses for each of the values.
If I were to provide guesses, they would be exactly that.... guesses

Any advice?



1) the Y0 parameter should appear only once, outside the sum. The way you've written it won't cause a problem, but it's inefficient.

2) You need the widths of the Gaussian and Lorenzian peaks to be the same, presumably. So you need to use just the B parameter (full width at half max of the Lorenzian) and set width = 2*sqrt(ln(2))*B. I think I have that right...

3) You could use the built-in Lor fit, then use the parameters from that fit as the initial guess for your combined fit.

4) Oh, yeah- you can also take the A outside the sum. So the final equation will be something like

Variable gwidth = 1.6651092223154*B
f(x) = y0 + A*(0.8*exp(-((x-x0)/gwidth)^2) + 0.2*(y0 + A/((x-x0)^2 + B)))

Where the fit parameters are y0, A and B.

By the way, there is just one dependent variable here; it is the result of evaluating the equation. The things called y0, A and B are "fit coefficients". X is the independent variable.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
You really should have opened a new thread...

YHLien wrote:
Is it possible to access the Voigt function via the operation FuncFit?


Go to your Igor Pro folder (a quick way to find it is to use Igor's Help menu). In the More Extensions folder, find Curve Fitting->MultipeakFit.xop. Make an alias or shortcut to that file in the Igor Extensions folder. Re-start Igor. Note that there is a help file in the same place as the .xop file. It has documentation for the functions defined in the XOP file. You can open that file easily in Igor using this command:

DisplayHelpTopic "Voigt"

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
I have some more questions about FuncFit. I tried to construct a function like:

Function Fitting_peaks(Data_y, Data_x, Funcs_fitting, coefs)

Wave Data_y, Data_x, coefs
String Funcs_fitting

String test

test = "{" + Funcs_fitting + "," + "coefs}"
FuncFit {String=test} Data_y /X={Data_x}

End

I executed the function like Fitting_peaks(wave_y0, wave_x0, "gauss", coef) and I got a error message "parameter wave was null or missed". Could somebody help to point out the error in the function? Thanks in advance.
Perhaps you are doing this as a first step to using the Sum of Fit Functions feature, but it looks odd- you appear to be using the syntax for Sum of Fit Functions, but with only one fit function.

The error suggests that the wave reference "coefs" doesn't correspond to an actual wave that exists at run-time. Did you create a wave called "coefs" in the current data folder?

Perhaps if my suggestions don't help you figure out the solution you should send us a copy of your experiment file (the .pxp file) to support@wavemetrics.com.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
Dear John,

Thanks for your reply. That is exactly what I am doing now. I started from single function to simplified debugging. I tried the sum of functions form of FuncFit with single function in command line and it worked. I did the check you mentioned before I posted my question. I found it worked if I directly used the coefficient wave instead of passing it through function interface.

Should I address the email directly to you?

Yu-Hung Lien