LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Nonlinear curve fit function

Solved!
Go to solution

ok,then i will attach the one that does not work.

0 Kudos
Message 21 of 29
(1,416 Views)

i add a few parameters. then it does not work, even can not stop when clicking "stop" button.

0 Kudos
Message 22 of 29
(1,415 Views)
Solution
Accepted by topic author caplee

Your initial parameters array contains a differnt number of elements than the list in the formula. The values for a3 .. n are all missing. Entering something for those values eliminates the parsing error.

 

Then I got a singular matrix error which was probably due to entering zeros for some of those parameters.

 

Some values of those parameters make the loop very slow, but it will stop in a minute or two if you wait long enough.

 

With the default initial parameters and a3 .. n all set to 1, the guess plot is inverted and approximately = 1 while the data is ~1E-5, so that is a poor guess. Each iteration of the loop takes about 3 seconds. Changing y0 to -0.5, a1 = -0.0001, a2 = -0.0004, and a3 = -0.1 produces a guess which is the right shape but 5 orders of magnitude too large. Each iteration takes about 2 seconds.

 

With a VI for the function(rather than the formula) the times per iteration drop to 30-50 ms.

 

Lynn

Message 23 of 29
(1,399 Views)

thank you very much. Smiley Very Happy

 

can you display the three fitting pictures on the same graph? i have a try, but it did not work, it only displays the raw data picture, the best-fitting picture,but no guessing picture or a red line which is linear. Still, i am very happy. the problem annoys me for a quite long time.i want to ask you that how long i need to be a good developer of labVIEW, i bought "the labVIEW style book". actually, the VI you provide is a little difficult for me to understand. what i can do is only to input parameters and see the result.

finally, thank you again for your sincerely help~

0 Kudos
Message 24 of 29
(1,390 Views)

Yes you can display all three plots on one graph. The tricky part is that the Guess values are so different from the data and fit values that one Y-axis scale will not work for all three. 

 

Right click on the Y-axis of the graph and select Duplicate Scale. Then Swap Sides. Go to the Properties dialog and select which plot is assigned to which scale.  I am not giving a step by step procedure for two reasons: 1. You have a chance to learn a lot about graphs by exploring the options on the properties dialog, and 2. I do not remember because I just look at the options to find the ones I want. Here is a quick example.

 

That is a well regarded book.

 

How long does it take to become a good developer? It depends on how much time you spend on working with LV, how much training you can get, and how much you learn from your experiences.  If you are working full time, can attend several NI training programs, and have some good LV programmers around to help you, you could be a reasonably competent developer in a year or two. On your own, working part time, with no training and no help, it might take much longer.

 

I am not sure which parts of the VI you do not understand. Please ask specific questions and I will try to explain what I did.

 

Lynn

Message 25 of 29
(1,377 Views)

OK, i have learned a lot from your words. it did work.

 

i am a postgraduate,the reason why i learn labVIEW is that my reasearch needs me to do so. i have learned this great software for two weeks, it is easy at the beginning, but a little difficult now. there is nobody around me helping me because we are all the new guys for this software, and they do not need to learn it. maybe through my continous effort, i will be a good developer someday.

 

at last, thank you for your sincerely help.

 

best regards

 

RIchard Lee

0 Kudos
Message 26 of 29
(1,368 Views)

Richard Lee,

 

You are apparently not the Rick Lee I worked with for > 20 years!

 

That is very good progress for only two weeks with LabVIEW!

 

Participation in this Forum can also be a good way to learn about LV. At first you will mostly ask a few qeustions and read other people's posts. Later you will begin to answer some questions as well. Much of what I have learned about curve fitting for example I learned through the Forum. 

 

Again, feel free to ask any questions you may have about the VIs I posted so that you can learn more.

 

Lynn

Message 27 of 29
(1,347 Views)

of course i am not. 

 

i want to ask you one more question: it is about the "Timed Loop" VI. there is a option called "deadline" in the Input Node, and the default value of it is "-1ms".why is that?  by "context help", i know that this option limits time between iterations. if the iteration does not finish on time, then the "Finish Late" will generate a pulse. i want to know the relation between "deadline" and "period".

 

thank you for your kindness

 

Richard Lee

0 Kudos
Message 28 of 29
(1,339 Views)

I do not have the timed loop. It is limited to WIndows and the Real-time OSes, I think. 

 

You certainly do not need it for the work you are doing now. Use the timing in your data acquisition device for the data. The analysis and displays do not need that kind of capability.

 

If you want to explore capability of the timed loop, you should start a new thread. The topic is completely different from this one and you have marked this one as Solved, so some people no longer watch the thread.

 

Lynn

0 Kudos
Message 29 of 29
(1,335 Views)