LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

inverse prediction order 2 or 3 polynomials

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 helpSmiley Very Happy

0 Kudos
Message 11 of 15
(883 Views)

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. 🙂

0 Kudos
Message 12 of 15
(872 Views)
Altenbach,

if you have a look at the Lev-Mar rroutines shipped with LV 8.2.X you'll see that they're included the option of calling a model by reference in their implementation.  This REALLY improves performance over the old text-based solution only.

To the best of my knowledge, the NI version is also using a Newthon-Raphson optimisation, no?  At least a similar approach if I'm not mistaken (Which I may well be of course).

Shane.
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
0 Kudos
Message 13 of 15
(862 Views)
Shane,
 
I think you misuderstood my point. I am very aware of the 8.0+ Lev-Mar implementation and even gave a talk and demos about it at the last two NI week meetings in Austin. 🙂
 
My point was to get the inverse function of the model function once you have the best fitting parameters. This is a seperate task.
 
The model function calculates y=f(x). We now want to calculate x for any given f(x).
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.
This can be done using newton-raphson and for convenience, we can make a VI with the following connectors:
  • Inputs
    1. a function VI reference to the model y=f(x) (using the same connector pattern as the Lev_Mar model function).
    2. y1
    3. An estimate for x1
  • outputs
    1. x1 such that x1=f(y1), (using newtwon-raphson)
 This way we can change the model but don't need to change the rest of the code. 🙂
 
0 Kudos
Message 14 of 15
(856 Views)
Altenbach,

it truly would have surprised me if you HADN'T known about the new features, so the fact that you're implying something else than I understand doesn't surprise me really.

Having never been in Austin, I wouldn't know about anything you're presented.

I get what you're saying now.

Shane.
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
0 Kudos
Message 15 of 15
(841 Views)