LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to build an equation with variables

Solved!
Go to solution

I want to solve an equation shown in below by the Newton Raphson zero finder vi:

 

z-a*b*c*exp(-z/a),

 

a, b, and c are variables

 

I can build equation with constant a,b,c, but how can I build this one?

 

Many thanks!

 

0 Kudos
Message 1 of 8
(3,436 Views)

LabVIEW has several types of solvers.  Use the search function in the BD function palette.

 

Your equation does not make much sense.  The parameter "a" appears in two places but "b" and "c" only appear as a product.  Unless you have other constraints not shown, you cannot solve for "b" separately from "c".

 

Lynn

0 Kudos
Message 2 of 8
(3,424 Views)

Sorry, my explaination might be incorrect.

 

z is the unknow. a, b and c are given by other calculations.

 

Is this make my question more clear?

 

Thanks

0 Kudos
Message 3 of 8
(3,417 Views)
Solution
Accepted by topic author Ole_Su

Use the number to string functions in the string palette along with the concatenate string primitive to create a formula with your values of a, b, and c.  Read the detailed help carefully for information about the limitations on variable names.  "z" is the only variable in your formula for the zero finder.  Example is in LV2009.

 

Lynn

0 Kudos
Message 4 of 8
(3,402 Views)

Thanks!

 

I tried the Concatenate Strings Function yesterday, it just doesn't work. May be some minor mistakes.

0 Kudos
Message 5 of 8
(3,387 Views)

A couple of points I usually feel compelled to make when I see the use of the NR method.

 

1)  Not an issue in a simple case like this, but the NR routine is typically a poor choice when you have a 1D problem and you calculate the derivative numerically.

 

2)  If I am going to hardwire the formula like the previous example, then I will just use a VI instead of a formula.  I only use formulas when I want to be able to make changes on-the-fly.  I am just a bit dubious of the formula parsing VIs in general.

 

3) There is a VI called Substitute Variables which will take a set of rules and substitute numbers for parameters in your formula.  Here is a quick example of its use.  Here the names and number of parameters is fixed by the cluster itself.  If I need full flexibility I use a table to hold the parameters and their values, but I do not want to muddy the waters here.  You can just choose your favorite UI and convert (if necessary) to the proper cluster for the substitution rules.

 

18295i496094EDDC6B38D9

0 Kudos
Message 6 of 8
(3,363 Views)

Hi, How I can create a dynamic subVI Variables and Modbus OPC?

 

 

0 Kudos
Message 7 of 8
(3,152 Views)

This message thread is over 3 years old and has nothing to do with the question you are asking.

 

Start a new message thread.  And be sure to add some details to the quesiton.  I have no idea what you mean by "dynamic subVI variables".  And how does it related to OPC and Modbus?

0 Kudos
Message 8 of 8
(3,145 Views)