LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

complicated curve fitting

Hi Lynn. Attached are the amendments that I've made. I cleaned up the the VI's, but I don't quite understand what you meant by:

 

"One problem is a mismatch in the variant data.  Your model function is always generating numbers like 1E-86 for f(x) and the values coming from the data variant are always zero."

 

Kas

0 Kudos
Message 21 of 24
(760 Views)

Kas,

 

I think you have a problem with the data or the model.

 

But first, let me address the question you asked.  Because you had two different cluster datatypes, the Variant to Data function in the Model VI could not interpret the data put into the variant called "data" by the Main VI. So the values coming out of the Unbundle by Name in the model function were always zeros. This resulted in some very small values fro the rest of the function.  In some cases it may have been small enough to be interpreted as zero.

 

With the variant problem fixed I started looking at the reasons for the Maximum iterations exceeded errors.  I put probes several places within the model VI and plotted the occurrences of the error in the main VI.  The error occurred more than 20 times. I also noted that NaN and Inf values were showing up on the Probes.  When these values occur, some of the intermediate values are in the 1E80 to 1E100 range.  When you try to take the exponential of a value that large, you get values out of the range of a double precision number.  So I tried scaling the frequency (which is where the big numbers occur) by 1E-12.  This eliminates the NaN and Inf values but the Maximum Iteration Errors still occur.

 

I also changed the stopping criteria to tolerances of 0.01 and max iterations = 10000.  This slows the program significantly but does not eliminate the errors. Even at 100000 iterations and 500000 function calls the error occurs over 30 times.  For the points where it converges the number of fucntion evaluation is rather randomly distributed between 15 and 300.  Thius is what makes me think you have a data or model problem.

 

Lynn

0 Kudos
Message 22 of 24
(750 Views)

Thanks for your input Lynn.

 

The model was taken from a published journal (attached to one of the previous ZIP files on this discussion). Me and my colleague are working to replicate the results of that paper. My colleague is approaching this issue using MathCad, whereas I'm doing this through LabView. The model itself keeps producing same values when tested on both software. We also believe that our interpretation of the math from that paper is correct, since it was written from a programmers points of view and not a physicist, hence making it more easier to understand.

 

If data is the problem, I will run the experimental work in my Lab again under strictest rules and procedures. Hopefully with the new set of data I may get better results.

 

I will post the results again as soon as I tested them out.

 

Thanks again

 

Kas

0 Kudos
Message 23 of 24
(747 Views)

Kas,

 

I plotted the frequencies where it does not converge and no pattern is obvious.  I am out of ideas.

 

Here are the VIs as I modified them.

 

Lynn

Download All
0 Kudos
Message 24 of 24
(740 Views)