LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using Levenberg-Marquardt fitting where f(x,a) is provided by another VI

Solved!
Go to solution

Awesome. Good to learn those ways of data transfer. I had just used a global variable before.

 

Great help and thanks for your time

0 Kudos
Message 11 of 18
(1,008 Views)

hello,

 I have a probleme with the Levenberg-Marquardt fitting VI.

 

I use some datas wich come from a excel file and wich is composed of two parts ( part X, part Y).

But in the X part, the datas have not a constant scale (for example, 0,1 0,2 0,5 1 2 5 ...) and to use Levenberg-Marquardt fitting VI,

i need to a constant scale, so how could i make that?

 

I had an idea, it was to draw a express XY graph  thanks to the excel datas, to determine some points with a constant scale (by a ponctual Y value.VI)

but any VI can be use with express XY graph, because there is a conversion problem (express XY graph is an array of two clusters) and i didnt´t find a tool to the conversion.

so could you advice me another solution

 

0 Kudos
Message 12 of 18
(945 Views)

Great tip about the Lev-Mar data input!

 

Question:

 

Why do you wire the Lev-Mar data terminal and send via Call by Reference???

 

By wiring the Lev-Mar data terminal won't this do the same thing?  Is there a conflict here?

 

The clusters are the same however the parameters are different.  How does Lev-Mar use this custom data cluster??

 

Clipboard01.jpg

0 Kudos
Message 13 of 18
(913 Views)

@battler. wrote:

Why do you wire the Lev-Mar data terminal and send via Call by Reference???

By wiring the Lev-Mar data terminal won't this do the same thing?  Is there a conflict here?


Sorry, I don't understand the question.

 

The model reference tell the nonlinear fit VI which model to use, and the data in the data terminal gives additional information to the model (In addition to the parameters and possibly the X-array received via the regular terminals).

 

I do a call by reference node on the main VI to calculate the model using the starting paramters. This is useful to see if the parameter guesses are reasonable. In its place, you could just call the model VI. My above method is more scaleable and easier to modify, for example of you would later point the model to a different VI, no other code changes would be needed.

 

It is also useful e.g. if you want to have a choice between different models. You could then use several static VI references and select which one to use at runtime.

0 Kudos
Message 14 of 18
(905 Views)

Also note that in LabVIEW 2012, you could use conditional indexing tunnels to simplify the FOR loop in the lower left.

 

In addition, the two decorations are covering up the controls so nothing can be operated. The decorations need to be moved to the back or deleted.

0 Kudos
Message 15 of 18
(897 Views)

Ah now I understand, you used Call by Reference to first set the starting parameters..  Thanks.

0 Kudos
Message 16 of 18
(891 Views)

I simply call the fit with max iterations set to zero and it returns the curve corresponding to the starting parameters. 

0 Kudos
Message 17 of 18
(886 Views)

@battler. wrote:

Ah now I understand, you used Call by Reference to first set the starting parameters..  Thanks.


The call does not "set" the parameters, it just shows you if they are reasonable. 😄

0 Kudos
Message 18 of 18
(878 Views)