
Multipeak fit with user baseline

R_C
I am trying to fit a user baseline within multipeak fit 2, but Igor doesn't seem to be able to converge on a decent fit, despite the starting parameters being close to acceptable. The function is a modified boatsman step function.
I have used the baseline function below, which seems to compile successfully, and works within multipeak fit. When I try to `Do fit' I get the error: 'Multi-peak Fit failed: singular matrix or other numerical error'. I find that this happens even with most variables constrained, or some held. If I hold all of the user defined baseline parameters, the program is able to proceed. Can someone help me with this? I have attached a simple example .pxp file.
Function/S Boltz_BLFuncInfo(InfoDesired) Variable InfoDesired String info="" switch(InfoDesired) case BLFuncInfo_ParamNames: info = "a1;a2;x0;dx;m1;" break; case BLFuncInfo_BaselineFName: info = "Boltz_BLFunc" break; endswitch return info end Function Boltz_BLFunc(s) STRUCT MPF2_BLFitStruct &s s.cWave[0]=-0.47054 s.cWave[1]=0.54243 s.cWave[2]=225 s.cWave[3]=14.9 s.cWave[4]=-0.00037 return s.cWave[1] + s.cWave[4]*s.x + ((s.cWave[0])/( 1 + exp ( (s.x-s.cWave[2])/s.cWave[3]))) end
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
May 3, 2017 at 04:34 pm - Permalink
Thanks John - is there some way I can give the parameters an initial value I know to be good? I'd like to be able to preload these rather than type them in each time.
May 4, 2017 at 12:31 am - Permalink
Maybe you are trying to do something you haven't told us?
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
May 4, 2017 at 08:54 am - Permalink
I was hoping to have preset values each time I load multipeak. I found I can do this saving each fit as a `checkpoint', which means each fit can start with the same preset parameters. Thanks for your help. Problem solved.
May 5, 2017 at 09:22 am - Permalink