LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Eval Single -Variable Scalar - formula string syntax

Hi Folks - I am testing out the ability of 'Substitute Variables.vi' and 'Eval Single-Variable Scalar.vi' in a very simple VI but I am getting a 'Bracket Problem at the end' error coming out of the latter.  I thought I had the syntax on this basic formula correct. I have 5 left parantheses and 5 right paranthases.  I use the ln(x) and exp(x) functions and several math operators including ** for exponentiation.

The string is:    a1*exp((-4*ln(2))*((x-m1)/w1)**2)      where x, a1, m1, and w1 are variables and x is the variable that will be evaluated in  'Eval Single-Variable Scalar.vi'

I am using the 'Substitute Variables.vi' to actually substitute constants for variables a1, m1, and w1.

It is concievable that the indicated error is pointing to something else that is incorrect.

Any help is appreciated.

Sincerely,

Don
0 Kudos
Message 1 of 6
(5,290 Views)
Use "^" for exponentiation instead of "**". See the online help for differences in syntax (image)
 


Message Edited by altenbach on 05-07-2008 08:49 AM
Message 2 of 6
(5,268 Views)
An unrelated issue: The constant arrays which autoindex into the for loop are of different lengths. The one with "6" has only one element, so the only one iteration of the for loop occurs.

Lynn
Message 3 of 6
(5,256 Views)
Yes - it works now so I am attaching again a simplied example for others to use to see how these functions can work together.  I knew there were some differences in the formula syntax rules but I did not see that table before.
 
Thanks,
 
Don
0 Kudos
Message 4 of 6
(5,250 Views)
Also remember that you should use the "array version" instead of a FOR loop of you need to calcualte it for multiple inputs. This saves on the expensive parsing. See the online help.
 
For example your original example (corrected) would look like the attached.
 
 
0 Kudos
Message 5 of 6
(5,239 Views)
Excellent point!......Don
0 Kudos
Message 6 of 6
(5,223 Views)