LabVIEW Exercises
LabVIEW Formula Node
A Formula Node in LabVIEW evaluates mathematical formulas and expressions similar to C
on the block diagram. In this way you may use existing C code directly inside your LabVIEW
code. It is also useful when you have “complex” mathematical expressions.
Task: Create a simple SubVI where you use the Formula Node to calculate a (slope) and b
(intercept) in the equation 𝑦 = 𝑎𝑥 + 𝑏 when you have two points (𝑥( , 𝑦( ) and (𝑥+ , 𝑦+ ).
The Procedure is as follows:
Step 1: Create a New VI (File→New VI) (Blank VI)
Step 2: Give the VI a Name (Linear [Link])
Step 3: Create your Front Panel with your necessary Controls and Indicators.
Example:
Step 4: Switch to your Block Diagram (Ctrl+E).
Step 5: Add the Formula Node to you Block Diagram:
[Link]
2
Step 6: Add Inputs and Outputs:
Step 7: Create your C-code inside your Formula Node.
The formula for finding the slope (a) and intercept (b) is as follows:
𝑦+ − 𝑦( 𝑦+ − 𝑦(
𝑦 − 𝑦( = (𝑥 − 𝑥( ), 𝑤ℎ𝑒𝑟𝑒 𝑎 =
𝑥+ − 𝑥( 𝑥+ − 𝑥(
The Block Diagram could look something like this:
Step 8: Create the Input and Output Connectors. Right-click on the little icon in the upper
right corner and select “Show Connector”.
Step 9: Create an Icon using the Icon Editor. Right-click on the little icon in the upper right
corner and select “Edit Icon…”.
LabVIEW Formula Node
3
Step 10: Create a new VI that you use to test your Sub VI.
LabVIEW Formula Node