I'm new to Igor, and I'd like to fit an exponential such as the black curve on the attached image. The data to be fitted is in red.
So far I have managed to use the multi-peak fitting function and the curve fitting.
You will get a window. On the panel of "Function and Data", there is an option to make "New Fit Function". You can start from there to define your equation. There is also a "help" button. You can learn how to fit a curve from there.
I'm new to Igor, and I'd like to fit an exponential such as the black curve on the attached image. The data to be fitted is in red.
So far I have managed to use the multi-peak fitting function and the curve fitting.
If you're using Multi-peak Fit, I presume you have more than one such peak in your data that you want to fit with that peak shape. Is that right?
The peak shape really doesn't fit that data well- are you sure you want that shape?
The peak shape is a two-sided exponential peak. We don't included that in Multi-peak Fit as shipped, but it can be added with some effort. First you would need to come up with a good user-defined fit function that implements that shape. Do you have an equation? Perhaps Y = exp(-abs(x-x0)/tau)? That would be like this:
Function twosidedExp(w,x) : FitFunc Wave w Variablex
//CurveFitDialog/ These comments were created by the Curve Fitting dialog. Altering them will //CurveFitDialog/ make the function less convenient to work with in the Curve Fitting dialog. //CurveFitDialog/ Equation: //CurveFitDialog/ f(x) = y0 + A*exp(-abs(x-x0)/tau) //CurveFitDialog/ End of Equation //CurveFitDialog/ Independent Variables 1 //CurveFitDialog/ x //CurveFitDialog/ Coefficients 4 //CurveFitDialog/ w[0] = y0 //CurveFitDialog/ w[1] = A //CurveFitDialog/ w[2] = x0 //CurveFitDialog/ w[3] = tau
return w[0] + w[1]*exp(-abs(x-w[2])/w[3]) End
If you copy that code into your Procedure window, you can select "twosidedExp" as the fit function in the Curve Fit dialog. It is suitable for fitting a single two-sided exponential peak, but not yet suitable for Multipeak Fit.
Analysis: Curve Fitting
You will get a window. On the panel of "Function and Data", there is an option to make "New Fit Function". You can start from there to define your equation. There is also a "help" button. You can learn how to fit a curve from there.
Good luck,
Yaohua
October 31, 2011 at 06:47 am - Permalink
If you're using Multi-peak Fit, I presume you have more than one such peak in your data that you want to fit with that peak shape. Is that right?
The peak shape really doesn't fit that data well- are you sure you want that shape?
The peak shape is a two-sided exponential peak. We don't included that in Multi-peak Fit as shipped, but it can be added with some effort. First you would need to come up with a good user-defined fit function that implements that shape. Do you have an equation? Perhaps Y = exp(-abs(x-x0)/tau)? That would be like this:
Wave w
Variable x
//CurveFitDialog/ These comments were created by the Curve Fitting dialog. Altering them will
//CurveFitDialog/ make the function less convenient to work with in the Curve Fitting dialog.
//CurveFitDialog/ Equation:
//CurveFitDialog/ f(x) = y0 + A*exp(-abs(x-x0)/tau)
//CurveFitDialog/ End of Equation
//CurveFitDialog/ Independent Variables 1
//CurveFitDialog/ x
//CurveFitDialog/ Coefficients 4
//CurveFitDialog/ w[0] = y0
//CurveFitDialog/ w[1] = A
//CurveFitDialog/ w[2] = x0
//CurveFitDialog/ w[3] = tau
return w[0] + w[1]*exp(-abs(x-w[2])/w[3])
End
If you copy that code into your Procedure window, you can select "twosidedExp" as the fit function in the Curve Fit dialog. It is suitable for fitting a single two-sided exponential peak, but not yet suitable for Multipeak Fit.
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
October 28, 2011 at 09:38 am - Permalink
Best Regards
November 3, 2011 at 11:01 am - Permalink