09-07-2007 03:50 AM
Well this is a very nice implementation indeed. I wish my code would be that nice on the first go.
I use the LM algorithm as it was a simple way to implement a wider solution where the basic regression model we use is the logistic one. I know it is a bit over the top to use it for polynomial or even linear fitting !!
But it works fine.
I like your example very much.
Thanks for your help
09-07-2007 10:51 AM
Of course for an arbitrary model, you can no longer use my solution. Here's what I would do:
Lets assume that your function is always increasing in the range you are using it and the desired function value is in the range you just fitted. (This is often a valid assumption, e.g. for a calibration curve). In this case, you would just get an estimate using threshold array from your best fit data, followed by a few Newton Raphson iterations to get the value with near infinite precision.
I think I have an old newton-raphson implementation that calls the model function via reference node, wIth a model type compatible with the nonlinerar fitting (VI model). This way your entire code can be made nearly model-free and will adapt automatically as you change the fitting model. I don't have access to my old code at the moment, maybe I can find it over the weekend.
(I even once fitted a function that required newton-raphson internally for the model calculation, but that's a different story.)
If your data is dense enough, a simple interpolation of the best fit data array would probably be sufficient. LabVIEW has all the tools for that. 🙂
09-07-2007 12:38 PM
09-07-2007 02:21 PM
The model function calculates y= f( x, [Ai] ), where [Ai] are given model paramters.Lev-Mar finds the best set of [Ai] such that [y(fit)] best matches [y(experimetal)].Newton-raphson calculates x=f'( y, [Ai] ) where [Ai] are the same given model paramters, e.g. obtained via Lev-Mar.
09-08-2007 09:13 AM