
Fitting multiple peaks procedure

ltizei
I am attempting to write a procedure to fit multiple gaussians to numerous spectra. I haven't been able to do it so far, the error being "Singular matrix or other numeric error". If I try the same fit to a single spectrum with the fit multiple peaks package it works!!!
I have tried to use the multiple peaks result as the initial guess to a single fit and it still doesn' work. This is the procedure I am attemting to run:
#pragma rtGlobals=1 // Use modern global access method. #include <Multi-peak fitting 1.4> Function Gauss3(w,x) : FitFunc 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+A1*exp(((x-X1)/B1)^2)+A2exp(((x-X2)/B2)^2)+A3*exp(((x-X3)/B3)^2) //CurveFitDialog/ End of Equation //CurveFitDialog/ Independent Variables 1 //CurveFitDialog/ x //CurveFitDialog/ Coefficients 7 //CurveFitDialog/ w[0] = y0 //CurveFitDialog/ w[1] = A1 //CurveFitDialog/ w[2] = B1 //CurveFitDialog/ w[3] = X1 //CurveFitDialog/ w[4] = A2 //CurveFitDialog/ w[5] = B2 //CurveFitDialog/ w[6] = X2 //CurveFitDialog/ w[7] = A3 //CurveFitDialog/ w[8] = B3 //CurveFitDialog/ w[9] = X3 return w[0]+w[1]*exp(((x-w[3])/w[2])^2)+w[4]*exp(((x-w[6])/w[5])^2)+w[7]*exp(((x-w[9])/w[8])^2) End Function Run() make/O/N = (10) coef coef={25147,4683.1,144.85,40.332,983.84,261.7,59.678,1258.7,77.517,130.99} FuncFit Gauss3 coef test /X = Xwave End
Thank you for any inputs.
Luiz
In case it helps, I attached one experiment with examples;
Thanks,
Luiz
March 22, 2010 at 09:10 am - Permalink
There is something missing in the pxp file: FileImport.ipf
In any case:
I think you are using the /M flag of LoadWave, that's why Igor creates 2D waves (matrices) even if your data is 1D. But the FileImport.ipf file would help debugging ...
gregor
March 22, 2010 at 09:24 am - Permalink
Thanks!!!
March 22, 2010 at 09:55 am - Permalink
Thanks!!!
March 22, 2010 at 10:04 am - Permalink