LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

non-linear curve fit tolerance

I am working on a curve fit using the non-linear curve fit LM and I am running in to problems with the program converging without a good fit.  I'm working with some very small numbers, for example, I reference current in terms of Amps so my y-values are commonly on the order of 1e-11.  When I ran my program in terms of Amps (1e-11) the program converged after only one iteration (provided I had a decent first guess at my fit parameters).  It helped a bit when I put all of my currents in terms of picoamps, however, it still doesnt' seem to be converging as well as I would like.  Is there some fundamental limit on the tolerance? I attached my vi's for the curve fit and the parent function.  Any help is appreciated! Thanks!
E
Download All
0 Kudos
Message 1 of 2
(2,993 Views)
Since your data is scaled "extremely", you need to either rescale as you did or wire the weight. I prefer to leave the data alone and wire the weight instead. A good guess would be 1/variance in the y data. Try e.g. 1e24.
 
The main problem however is that there is an error in your model function: You forgot to hook up the input to erf(x)! That's why it did not work after rescaling.
 
The attached modification show how to use weights instead of data scaling.
 
I have cleaned up your model function a little bit. Remember, there are primitives for square and squareroot, etc. It's just much more readable.
0 Kudos
Message 2 of 2
(2,987 Views)