FitFunc format for Curve Fitting dialoge wrt number of coefs


I have the following Fit function (Igor 6.12A on Windows XP) in use.
Function TwoVoightWithBG(w,x) : FitFunc
    wave w
    variable x

    //CurveFitDialog/ Coefficients 10
    //CurveFitDialog/ w[0] = o
    //CurveFitDialog/ w[1] = A
    //CurveFitDialog/ w[2] = u
    //CurveFitDialog/ w[3] = E0
    //CurveFitDialog/ w[4] = m
    //CurveFitDialog/ w[5] = o2
    //CurveFitDialog/ w[6] = A2
    //CurveFitDialog/ w[7] = u2
    //CurveFitDialog/ w[8] = E02
    //CurveFitDialog/ w[9] = m2
    wave background = testData_bg
    Make/O/D/N=6 firstFunc, secondFunc
    firstFunc[0,4] = w[p]
    secondFunc[0,4] = w[p+5]  
    return VoigtFit(firstFunc,x) + VoigtFit(secondFunc,x) + background(x)

Unfortunately the Curve fitting dialoge can not determine the number of coefficients. The "Global Analysis" dialog is able to determine them correctly.

What am I doing wrong?


Hm. The Global Analysis procedure simply reads the comment and believes it. The dialog has very complicated code to parse the code itself and determine the number of coefficients based on the maximum index used with the w symbol. The use of "w[p]" defeats that code. I suppose in this case the dialog should fall back on the comment!

The work-around is to simply select a coefficient wave with the correct number of elements. The dialog then uses the number of wave elements as the number of coefficients. Unfortunately, you still don't get the mnemonic coefficient names. I will have to look into changing the way the dialog works.

John Weeks
WaveMetrics, Inc.