Fit with constraints using a parameter wave

I'd like to perform a fit using a custom function
Function N2_qcq(w,x) : FitFunc // quadratic cubic quadratic fit
    Wave w //  
    Variable x
   
    if( x<w[0])
         return    w[1] + w[2]*(x-w[0]) + w[6]*(x-w[0])^2;
    elseif( x <w[3] )
            return w[1]*(x-w[3])/(w[0]-w[3]) + w[4]*(x-w[0])/(w[3]-w[0]) + (w[2]-(w[4]-w[1])/(w[3]-w[0]))*(x-w[0])*(x-w[3])^2/(w[0]-w[3])^2+ (w[5]-(w[4]-w[1])/(w[3]-w[0]))*(x-w[0])^2*(x-w[3])/(w[3]-w[0])^2;
    else
                return w[4] + w[5]*(x-w[3]) + w[7]*(x-w[3])^2;
     endif
end    


I'd like to pass linear constraints (upper/lower boundary) to funcfit using /c=Constraints where Constraints is a text wave
What is the appropriate syntax to apply constraints on w[i] ?
k0 > lowerlimitofw[0]
k0 < upperlimitofw[0]
k1 > lowerlimitofw[1]
etc.

Replace "lowerlimitofw[0]" with an actual number or and expression that can be evaluated from Igor's command line.

You can read about the formation of the constraint expressions by executing this Igor command:

DisplayHelpTopic "Fitting with Constraints"

And you can use the Curve Fit dialog, entering the constraints in the Coefficients tab, and see how the dialog forms the text wave.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
In fact I want to know if, having w the numerical wave that contains the parameter if my function, I should use:
wave w
variable limit1,limit2
w[0]>lowerlimit
w[1]<limit2


or something like
wave w
variable limit1,limit2
w_0>lowerlimit
w_1<limit2

Neither. As I said previously, you should use expressions like
K0>lowerlimit
K1<limit2

The symbols like "K0" are special symbols that are interpreted by the curve fitting code to stand in for coefficient wave elements. They will work regardless of the name of the coefficient wave's name.

From the help topic I referenced earlier, but in a subsection:

DisplayHelpTopic "Constraint Expressions"

"In the expressions the symbol Kn (K0, K1, etc.) is used to represent the nth fitting coefficient. This is like the Kn system variables, but they are merely symbolic place holders in constraint expressions."

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com