fixing a start value for (exponetial) fitting
Lars
I'm wondering if there is a way (command) to define a start value for a given fit function (in my case I'm interested especially in exponential fit functions). So being able to force the fit function to cross this point.
With best regards, Lars
1. You can fix the fitting range (start/end point) either by using the curve fit dialog (second tab) or you can specify the range using wave notation.
curvefit exp_xoffset wave1[2,200] //only fit the range from point 2 to point 200
2. If instead you wish to fix a parameter of the fit (such as the y-offset), use the /H flag (1 = hold, 0 = fit)
3. If you're asking about enforcing the fit to go through a specific x-y point ("force the fit function to cross this point"), I don't know if this is possible.
November 4, 2013 at 07:08 am - Permalink
November 4, 2013 at 01:44 pm - Permalink
1. You could solve the algebra and derive a new functional relationship between y and x that has one less degree of freedom due to the constraint. Then fit the new function
2. You could enter the fixed x0,y0 point as a measured data point for the fit with an extremely small error so that whatever your fit adjusts to come near the other data points, it will pass extremely close to the point.
I suspect 1 is the better approach, but you could experiment with 2 pretty easily if your fit is already set up.
2 sounds tempting from a purely algebraic view, but I think the limited range of actual floating point numbers might make it not work very well. You cannot set the uncertainty to 0 exactly (which is essentially what you're saying when you say the fit must pass through a point) or Igor will give you an error. Set it finite but still too small and the fit may complain about singular errors, or conclude that it has reached the desired tolerance and quit iterating with what is still clearly not the best fit for the remaining points because the "constraint point" dominates the calculation of chi squared. Set it too large and it will act like a normal data point...the fit routine will weight the "fixed" point more heavily than the others but won't necessarily force the fit function to pass close enough to it for your requirements.
November 6, 2013 at 09:55 am - Permalink
The algebra in this case is easy enough, if you first shift the data so the fixed point is at x=0. If it's just an exponential fit without a baseline, then all you need to do is hold one parameter, which you can do within the Igor curve fitting user interface.
In general, if algebraic elimination is not practical, the alternative to "soft constraints" is the technique of Lagrange multipliers: you add a degree of freedom multiplied with the error term, and then solve a bigger system in which this additional degree of freedom ends up being the force needed to enforce the constraint. That's not something you can do within the curve fitting interface, however.
If you want to go with soft constraints, I would recommend doing a convergence study, where you plot the fit parameters versus the (logarithm of the) weight coefficient for the "constraint point", so at least you see what's going on with the changes in the weight coefficient.
November 8, 2013 at 03:08 am - Permalink