08-14-2014 04:41 AM
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.
Solved! Go to Solution.
08-14-2014 05:56 AM
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
08-14-2014 06:28 AM
i see your answer, i will test it right now.
08-14-2014 06:43 AM
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?
08-14-2014 06:51 AM
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.
08-14-2014 06:56 AM
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-w
08-14-2014 07:13 AM
could you please provide your actual vi with initial values you are using? I am not able to replicate the error. thanks
08-14-2014 07:24 AM
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
08-15-2014 01:55 PM
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
08-15-2014 03:12 PM - edited 08-15-2014 03:39 PM
OK, the formula:
y=y0 + (nr*cos(a)) + a1*(x-w1)/((x-w1)^2+l1^2) + a2*(x-w
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.