LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error -20003 from nonlinear curve fit LM Bound with a VI as curve fit model

Solved!
Go to solution

Hi there,

 

I have been stuck for a while now by an error occurring when I use the Nonlinear curve fit LM Bound with a VI as the curve fit model. The error code is -20003 and occurs at the "LM get new coefficients" vi and the analysis says "The number of samples must be > 0". I checked a number of things but I can't get rid of it. The VI is pretty simple: it uses a data base of three arrays of numbers (or spectra) and it aims at fitting a curve that is the sum of those three spectra in order to determine the multiplicative coefficient associated to each spectrum. The code is joined to this message, thank you very much for any input!

0 Kudos
Message 1 of 5
(3,562 Views)

Hi Jeraud,

 

I found these forums with similar issue:

 

http://forums.ni.com/t5/LabVIEW/constrained-lm-fit-having-problem/td-p/902909

http://forums.ni.com/t5/LabVIEW/Levenberg-Marquardt-curve-fitting-pt-2/td-p/582187

 

Please take a look to them.

 

Best,

 

Carmen C.

0 Kudos
Message 2 of 5
(3,539 Views)

Thank you for your input, I went through those topics and tried a few modifications, but still the same error. I tried to replace the constrained nonlinear curve fit VI by the nonlinear curve fit VI and it gives the same error. I checked the size of the f(X,a) array and it is the same as the size of my input array. I could not find an example where actual data (in opposition to a mathematical model) where used as an input to the curve fit model. This VI simply aims at scaling the amplitude of stored traces to match the input array. All the data are included in the previously attached code so one can test the VI easily. Thank you for your help! 🙂

0 Kudos
Message 3 of 5
(3,533 Views)
Solution
Accepted by topic author Jeraud

Looks like your model function has default data stored in the f'(x,a) output.  Try emptying that array (make sure to 'save as default' after emptying) and rerun.  This solved the problem on my machine. 

 

Aside from that specific error, it looks like your model is linear in the molecule spectra, so perhaps using General Linear Fit.vi is a better match for your problem?  Both algorithms yield the same results on my machine.

 

-Jim

Message 4 of 5
(3,516 Views)

Thanks a lot Jim, that was indeed the cause of my problem, I thought f'(x,a) was empty.

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