LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Bugs in Levenberg Marquardt VI

Hello.

I've noted a previous post on the chi-squared bug in the Labview 6.1 implementation of Levenberg Marquardt. I have another bug to report: the best-fit data returned by a sub-VI (Levenberg Marquardt Prep) does not correspond to the data generated by the best-fit coefficients.

Bug Fixes:
1) (Not new) Correct the calculation of chi-squared
(a) go to the top-middle For loop and insert a square-root operator in the wire for the standard deviation
(b) divide the "Chi2(a+da)" output of this For loop by the number of fit variables to obtain the reduced chi-squared parameter

2) (New) In the while loop of the sub VI there is a small case structure which updates parameters when the new fit has a better chi-square than the old
fit. You want to make sure that the BestFit data gets updated, too.
(a) Re-route the current "BestFit" array wire as an input to this structure.
(b) Create a new array from the top-middle For loop by wiring the output of the Formula sub-VI to the edge of the For loop -- this provides BestFit data from the new fit coefficients.
(c) Wire this data array to the case structure.
(d) For case FALSE (new fit better than old) connect the new BestFit array input to an output which goes to the BestFit indicator.
(e) For case TRUE (new fit not better than old fit)connect the old BestFit array input to the output which goes to the BestFit indicator.

- Guy
0 Kudos
Message 1 of 1
(2,555 Views)