‎11-11-2005 04:16 AM
‎12-06-2005 03:55 AM
Hi,
have a look on this forum entry: http://forums.ni.com/ni/board/message?board.id=170&message.id=30453
regards,ThSa
‎12-06-2005 06:20 AM
@dtroendle wrote:
How can I fit functions ranging from a basic linear fit to any user-defined function to a set of x-y data with the option of keeping single fit parameters fixed (e.g. a known slope in a linear fit)? Is there a simple approach to this problem, I guess I'm not the first to try it?
Daniel,
I have modified the Lev-Mar routines long ago to allow the runtime selection of which paramters should be fixed and which should be held constant. It is not very difficult to implement. I use it to fit EPR spectra where the model can have up to ~30 parameters, but typically only less than 10 are fit while the rest are kept constant.
Basically, I added a boolean array as input to Lev-Mar which has the same number of elements as the number of paramters of the model function. For each element, a TRUE means that the corresponding parameter should be fit while a FALSE means that the corresponding parameter should be held fixed at the value of the initial estimate.
You just need to seperate out the reduced problem for the fitting part, but carry all parameters along for the model calculation.
It works great!I am currently traveling in Japan and don't have access to my VIs. Please contact me next week by private e-mail (You can find my e-mail address on the FP of some of my examples posted here, e.g. HERE.
‎09-20-2009 07:12 PM
‎09-21-2009 09:58 AM
I'd suggest using 'Constrained Nonlinear Curve Fit.vi'. If the upper and lower limit for a given parameter are the same, then it is constrained to be that value.
-Jim