From: DonRoth on
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


test11.vi:
http://forums.ni.com/attachments/ni/170/321707/1/test11.vi
From: altenbach on
Use "^" for exponentiation instead of "**". See the online help for differences in syntax (image)
<img src="http://forums.ni.com/attachments/ni/170/321792/1/mathformula.png">
&nbsp;Message Edited by altenbach on 05-07-2008 08:49 AM


mathformula.png:
http://forums.ni.com/attachments/ni/170/321792/1/mathformula.png
From: johnsold on
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
From: DonRoth on
Yes - it works now so I am attaching again a simplied example for others to use to see how these functions can work together.&nbsp; I knew there were some differences in the formula syntax rules but I did not see that table before.
&nbsp;
Thanks,
&nbsp;
Don


test1_working.vi:
http://forums.ni.com/attachments/ni/170/321854/1/test1_working.vi
From: altenbach on
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.
&nbsp;
For example your original example (corrected)&nbsp;would look like the attached.
&nbsp;
&nbsp;


test11MOD.vi:
http://forums.ni.com/attachments/ni/170/321875/1/test11MOD.vi