LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

varying Lev-Mar init. conditions causes wide change in fit coeficients.

Hey, I'm trying to use the advanced Lev-Mar fit vi to fit an exponential decay with an offset. I noticed that when I vary the initial condition for the time constant by 5% I get significant changes in my fit coeficient for the same parameter. However, when I multiply my input Y values by 10^4, the fit coeficients are more robust and change little with initial conditions that vary more than 10%. Also, the values now seem to match well with values I obtain when I perform the same fit in the Origin plotting program. Why is this? All my values are in double precision so I don't see how this could be a precision issue.
0 Kudos
Message 1 of 3
(2,727 Views)
The Lev-Mar has a well-known "bug" in the termination condition IF you fail to wire the "standard Deviation Input". In this case, the standard deviation is taken as 1, which is fine except for the case where your y-data is very small (e.g. all in microvolts or nanovolts). In this case, the function is considered converged after one iteration using the initial guesses.

You have two options:
(1) (not recommended) Edit the Lev-MAR.vi and make the diagram constant in the bottom center much smaller.
(2) (RECOMMENDED!) Always wire a "standard deviation input array". In your case, just create an array with equal size as your data, initialized with numbers corresponding to the noise in your data. It does not need to be accurate, you could just take it as e.g. 10E-4 to 10e-6 times your y-range (y-max minus y-min).
Message 2 of 3
(2,719 Views)
That works great. Thanks!
0 Kudos
Message 3 of 3
(2,713 Views)