annulla
Visualizzazione dei risultati per 
Cerca invece 
Intendevi dire: 

Nonlinear curve fit function

Risolto!
Vai alla soluzione

hello everybody:

I am a new guy here and at the same time a new learner for labview. My laboratory need to fit data which is nonlinear, so i choose to use the nonlinear curve fitting VI model. But when i run the VI, the error is that:NI_Gmath.lvlib:LM formula string function.vi:7290001,or other error displayments. I have tried many times, but unfortunately failed. The problem may be the formular function expression. By the way, the design of VI is not mine, it is from NI forum. Any constructive suggestions will be welcomed.

The formular :

y=y0+(nr*cos(a))+a1*(x-w1)/((x-w1)^2+l1^2)+a2*(x-w2)/((x-w2)^2+l2^2)  

Actually, the formular is very long, i just write down a few ones.

Scarica tutti
0 Kudos
Messaggio 1 di 29
7.986Visualizzazioni

Hi caplee,

 

what is the error code of the error. I test your vi and obtained error code -20041 which means some matrix in vi is singular. I replace zero value in your inital paramters to non-zero value and then it works without error. Did you obtained the same error code?

 

Best regards,

CaravagGIO 

0 Kudos
Messaggio 2 di 29
7.960Visualizzazioni

i see your answer, i will test it right now. 

0 Kudos
Messaggio 3 di 29
7.952Visualizzazioni

sorry, it did not work. i do not understand :"replace the zero in the initial parameters with non-zero parameters". can you give me your testing parameters? the initial parameters need to guess first before the fitting runs. but i do not know how to guess, my teacher is out now, so can i see your parameters?

0 Kudos
Messaggio 4 di 29
7.945Visualizzazioni

First you should tell me if you have the same error 🙂 . The initial parameters is the array of 3 values [-4E-6, 11310, 0]. The last value was set to zero. I change this value to one. That's all.

0 Kudos
Messaggio 5 di 29
7.937Visualizzazioni

i have the same error too. i forget to tell you that: the formular is not what you see in the VI. it is y=y0+(nr*cos(a))+a1*(x-w1)/((x-w1)^2+l1^2)+a2*(x-w2)/((x-w2)^2+l2^2) . the number of the unknown parameters which need me to fit are nine or so. 

0 Kudos
Messaggio 6 di 29
7.934Visualizzazioni

could you please provide your actual vi with initial values you are using? I am not able to replicate the error. thanks

0 Kudos
Messaggio 7 di 29
7.924Visualizzazioni

i do not have now. i just test the vi again, the error code is -23082,which means: bracket problem at the beginning.

if i can find,message u later

 

0 Kudos
Messaggio 8 di 29
7.919Visualizzazioni

A bracket error is probably due to a typing mistake in entering the formula.

 

It is often useful to plot the data calculated by the formula and to compare that to a plot of the data ta the same scale. This method often allows rapid identification of errors in the formula which cause the function to be very different from what you expect.

 

In many cases the formula parsing results in the fitting process to take much longer than the version which uses a VI to calculate the function values.

 

Lynn

0 Kudos
Messaggio 9 di 29
7.875Visualizzazioni

OK, the formula:

 

y=y0 + (nr*cos(a)) + a1*(x-w1)/((x-w1)^2+l1^2) + a2*(x-w2)/((x-w2)^2+l2^2) 

 

Can never be fit with a unique solution, because y0, nr, and a are obviously 100% correlated and simply add up to a single offset in the data. I would leave the term (nr*cos(a)) out for the time being.

0 Kudos
Messaggio 10 di 29
7.864Visualizzazioni