LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Curve fit and Error -20039

Good Day,

I have some problems with my (simple) curve fit program and the input data (read from excel). I found already the answer (somewhere in this forum) but I don't know how to do this.

DSPGuy aka Jim said: 

"The problem is in the model function. After the convolution the size of the output array f(x,a) is not the same as the number of data points."  and

"The fix is to modify your model function to output the same number of points as your y-data."

 

My model function looks like this (look at picture). The number of my input data is ~108. How could I modify my model function to generate 108 points?

 

I'm using Labview 2012.

 

0 Kudos
Message 1 of 4
(2,526 Views)

Hi Thion,

 

next time, please upload the VI instead of just a screenshot. It makes debugging much easier 🙂

 

I did not understand quite well at which point of the execution the error occurs. But if you have problems with different array-sizes, you could try using a for-loop with auto-indexing, so that the loop executes exactly as many times as you have elements in your array.

0 Kudos
Message 2 of 4
(2,485 Views)

Hello Oliver.M,

Thank you for your answer. I haven't uploaded the VI because it is a co-simulation between Labview and Multisim and I guess most of you do not have both programs.

 

I try to explain my problem:

The non-linear curve fit function (Levenberg Marquardt) needs some input data (I want to use 100)  to have some supporting points. It tries to fit the function and produces some output data (~106).

The error occurs when the output data (~106) isn't equal to the input data (100) so I need a restriction for the output data.

 

I think a for-loop will not work because the fitted function could have 100 points then, but those points are not equally distributed.

I thought there should be an option where you can say: produce only 100 points..  but unfortunately I can't find such an option.

0 Kudos
Message 3 of 4
(2,456 Views)

I solved my problem (or at least it looks like it)

The problem was that I had not configured the Collector, especially the "sample period (sec)" option. With 106 data points and 0.1s simulation time the sample period(sec) must be 0.1 / 106.

 

But now I have another problem with the Collector. It is possible to use three different "execution types" (continuous / continuous with minor time steps and discrete).

With "continuous" I get a good fit but the input data points and output data points are not exactly equal.

With "continuous with minor time steps" the output data points are just weird.

With "discrete" the fit will not be good (especially at the beginning) and I just do not know why.

 

Are there some programs that explain those different execution types?

0 Kudos
Message 4 of 4
(2,416 Views)