# Curriculum and Labs for Engineering Education

cancel
Showing results for
Did you mean:

## ME Lab 4 - Math with LabVIEW

Purpose:

The purpose of this assignment is to reinforce basic array operations. You will examine methods on how to manipulate arrays and how to do math on array values.  This assignment will also lay the groundwork for a later assignment.

Create a SubVI that is callable. This routine should accept a 2D array of values, perform the calculations as listed below, and return both a final value and a 2D array.  The output array should contain all the data from the input array (columns A, B, and C) as well as the calculated columns of D and E.  The SubVI should be capable of dealing with any number of rows provided in the input array and not be hardcoded for a fixed number of rows.

The column values should be as follows:

A= Defined input Value

B= Defined input Value

C= Defined input Value

D = (|B - A| + |C - A|) / 2

E = D^2

The final value is a single floating point value number calculated by summing the values in Column E and then taking the square root of that sum.

Final Value = sqrt(sum(column E))

Test the SubVI by entering in columns A to C into the input array.  The output array should be as follows:

 A B C D E 6 5 7 1 1 6 5.5 6.5 0.5 0.25 6 9.25 4.25 2.5 6.25 6 7.3 5.2 1.05 1.1025

The Final Value should be equal to 2.933.

LabVIEW Resources:

For help with porogramming in LabVIEW please review the appropriate videos in our Learn to LabVIEW with MyDAQ Course.

Report and Submission:

Document your program in a memo format and include both a screen shot of the SubVI with the completed calculations in it and its block diagram.  Your documentation should also include the full VI documentation (front panel, block diagram) for your SubVI.  Discuss in the memo what problems you encountered, if any, in creating this SubVI.  You may work in teams of 2 for this assignment.  Be sure to include the grade sheet as the final page of your report submission.

Hints:

You may find the following hints to be of value.

• Remeber for loops with auto-indexing
• Useful functions:
• Index Array
• Build Array

Remember that if you leave one index undefended on the index array function, that the function will return a sub array that contains that row or column rather than a single value.

To pass values into the VI you will need to right click on the front panel icon and “show connector”.  Connect the terminals to your input and output values you want to pass.