LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Levenburg Marquardt optimization

Hi,

I'm trying to fit real data with the Levenburg-Marquardt (L-M) VI to extract some material parameters from a model equation.  I'm using the 'function is VI' instance of the L-M VI, where I think I've got my model equation VI referenced and typed correctly.  However, the L-M fitting VI returns my initial guess parameters as the optimized output, regardless of initial parameter choice.  Is my data set too small, or is there some obvious wiring problems here, or.....?

Any help is greatly appreciated.  I'm using LV 2013.  (This is my first shot at data consumption; usually I just need LV for equipment automation, which is cake compared...)  🙂

Download All
0 Kudos
Message 1 of 5
(3,636 Views)

I do not have the Mathscript module so I cannot run your VI. Using the Mathscript module is probably much slower than the same code implemented in standard LV functions.

 

Using x as the array index inside the Mathscript and as a parameter to be fitted in the main VI seems like a great opportunity for confusion and errors. At the very least document what you are doing.

 

Why do you have the Call by reference node in the Fitting VI? You do not use the output (except error). The L-M VI calls the model VI by reference internally.

 

What does the output of the model function look like when plotted against the data?

 

Lynn

Message 2 of 5
(3,626 Views)

Lynn makes some good points already.

 

Note that your Y range is very small, so the default tolerance will make it think it is converged way too early. Simply set the tolerance to a smaller value (e.g. 1-e16). Here's a quick cleanup, seems to fit just fine. (I still think things are probably not quite right, we would need to analyze the covariance matrix, etc.)

 

I strongly recommend to implement the model in plain LabVIEW, not mathscript, for performance reasons (not shown). Do you have a web page describing the model?

 

Message 3 of 5
(3,606 Views)

Thanks for the help Lynn and Altenbach!  I rewrote the reference VI using Formula Node rather than MathScript.  I also updated the data set I'm trying to fit with something with more response variable range, and changed to a Constrained L-M.  These are attached if you're interested. 

 

I'm modeling temperature dependent charge carrier recombination in a semiconductor (following Blakemore's Semiconductor Statistics).  I'm trying to quantify the error in the fitted model, and it seems that finding a global minimun is a bit tricky.  I have parameter bounds based on physical parameters I can measure, but still seem to find more than one solution to the model that I could justify based on other measurements I'm making.... 

 

Thanks again for the quick response.

James

Download All
0 Kudos
Message 4 of 5
(3,544 Views)

As a first step, you should always also graph the curve based on the paramtere guess to see if the guesses are reasonable.

 

Your model is really hair trigger and since your parameters cover 16 orders of magnitude in values, all internal matrices are relatively ill conditioned. Why not use e.g. log(n) for the second parameter instead? (just add 10^n before the loop inside the model).

What if you fix some of the parameters? Some seem strongly correlated (e.g. n and Et).

I would not use the contrained version.

0 Kudos
Message 5 of 5
(3,534 Views)