Activity 3 Elementary Mathematical Functions in LabVIEW 1
Activity 3 Elementary Mathematical Functions in LabVIEW 1
The previous activity has focused in the development of LabVIEW program using basic arithmetic,
comparison and Boolean functions. This activity is a one-level higher continuation of Activity No. 2 which
will be focusing on the use of elementary mathematical functions of LabVIEW. The elementary and special
functions in LabVIEW include trigonometric, exponential, hyperbolic functions but not limited to discrete
mathematics, Bessel functions, linear algebra, curve fitting, interpolation, extrapolation and optimization.
LabVIEW can be used to interpret data that require the use and application of higher mathematical
operations. A number of engineering design and analysis depends on how data will be treated. Say for
instance, a set of data coming from a controlled experiment is tabulated and then plotted against the x and
y axes. The programmer then noticed that the data points obtained are scattered everywhere in the plane.
Mathematically, these data are remained untreated such that they cannot be evaluated directly by
modelling the behaviour of experiment as a mathematical equation. To easily interpret these data, curve
fitting may be employed. This means that the scattered data points may be represented closely by a
geometric function including linear, polynomial and cubic function.
Another application that a LabVIEW platform can administer is optimization. This technique is used
to select the best possible elements in a group of data depending on a given criteria. For example, a metal
can factory wants to design a can for preserved foods. Using the optimization techniques in LabVIEW the
company can decide on how much dimensions of the can will give them the minimum cost of production
with maximum capacity as much as possible.
LabVIEW also offers tools for statistics. It includes measures of central tendency like mean,
median and mode. Might as well, LabVIEW has the ability to interpret complex function, mathematical
functions containing real and imaginary elements.
Page 21
ECE 100 Fundamentals of LabVIEW Programming
1. Open LabVIEW 2012 and let the Front Panel and Block Diagram windows appear. On the Block
diagram window, right-click anywhere in the empty space and choose
MathematicsElementaryTrigonometric and drag and drop the six basic trigonometric functions sin,
cos, tan, csc, sec and cot.
2. On the Front Panel window, drag and drop a Knob control and connect the Knob control output node
to the input nodes of the trigonometric functions. Change the scale of the Knob control from 0 (minimum)
to 3.5 (maximum). Put Numeric Indicators for the output of the corresponding trigonometric function. Save
your VI as Act3_1_1.VI
3. Click on the Run Continuously button and adjust the control knob as follows:
a. 1.25 c. 1.57
b. 0.56 d. 3.13
Page 22
ECE 100 Fundamentals of LabVIEW Programming
(1.25) (0.56)
(0.56) (3.13
4. Consider the table below. Record the values of the six trigonometric functions for the given values below:
5. Verify using your scientific calculator in DEGREE mode the values recorded on the table above.
Question: Compare the results of the values tabulated above with the values you have computed
using your scientific calculator. Is there any difference in the value? If there is a difference, why do
you think so?
Yes, there is a difference because in the calculator, it is in the degree mode while in the program the
values are in the radian mode.
Page 23
ECE 100 Fundamentals of LabVIEW Programming
6. Modify the VI such that the value on your program and scientific calculator matches without omitting
the values of control knob. Save the modified VI as Act3_1_2.VI. SCREEN-CAPTURE the Front Panel
and Block Diagram for this procedure and include it in your activity report.
1. Clear the Front Panel and the Block Diagram from the
previous activity done. Create a Front Panel VI as shown
below: Save VI as Act3_2_1.VI
2. On the Block Diagram
Window, drag and drop
Exponential functions. Right-
Click anywhere in an empty
Space, go to Mathematics
ElementaryExponential
And drag and drop the ff:
a. Exponential
b. Exponential Arg (-1)
c. Power of 10
d. Power of 2
e. Logarithm Base-10
f. Natural Logarithm
3. Connect the Exponential function to Numeric Indicator
labelled as Output 1. Connect Exponential Arg (-1) to Numeric Indicator labelled as Output 2. Connect
the other functions in their respective indicators following the sequence from c to f in the previous page.
4. Consider the table below. Record the values for the given values below:
Input values Exponential Exp Arg (-1) Power of 10 Power of 2 Log Base Natural
10 Logarithm
0.00
0.50
1.00
1.50
2.00
2.50
3.00
3.50
4.00
4.50
5.00
5.50
6.00
6.50
7.00
Page 24
ECE 100 Fundamentals of LabVIEW Programming
7.50
8.00
8.50
9.00
9.50
10.00
Question: Explain each functions used in the calculation of the tables given above.
Question: What are the other functions under Exponential and explain each function?
1. Clear the Front Panel and the Block Diagram from the previous activity done. Create a Front Panel VI
as shown below:
Page 25
ECE 100 Fundamentals of LabVIEW Programming
2. On the Block Diagram, drag and drop the six hyperbolic functions and connect to its numeric indicator
labeled Output 1 to Output 6 respectively. The hyperbolic functions in sequence should be sinh, cosh,
tanh, sech, csch, coth respectively. Save your VI as Act3_3_1.VI
3. Consider the table below. Record the values for the given values below:
Input values sinh cosh tanh csch sech coth
0.00
0.50
1.00
1.50
2.00
2.50
3.00
3.50
4.00
4.50
5.00
5.50
6.00
6.50
7.00
7.50
8.00
8.50
9.00
9.50
10.00
Question: Explain each functions used in the calculation of the tables given above.
Hyperbolic Sine – Computes the hyperbolic sine x.
Page 26
ECE 100 Fundamentals of LabVIEW Programming
Question: What are the other functions under Hyperbolic Functions and explain each function?
Inverse Hyperbolic Sine – Computes the inverse hyperbolic sine x.
𝐿
𝑑 = 𝑎(𝑐𝑜𝑠ℎ − 1)
𝑎
Create a VI that will allow to compute the value of “d” for each of the given “s” and “L” from 0 to 1000. Use
a dedicated control knob and customize your VI. Save your VI as MacPro3_1.VI
2. The Taylor Series expansion for the hyperbolic sine function is given as:
∞
𝑥3 𝑥5 𝑥7 𝑥 2𝑛+1
𝑠𝑖𝑛ℎ𝑥 = 𝑥 + + + + ⋯ = ∑
3! 5! 7! (2𝑛 + 1)!
𝑛=0
While for the hyperbolic cosine is:
∞
𝑥2 𝑥4 𝑥6 𝑥 2𝑛
𝑐𝑜𝑠ℎ𝑥 = 1 + + + + ⋯ = ∑
2! 4! 6! (2𝑛)!
𝑛=0
Where n is the number of terms to be added to the series. Create a VI that would compute the sum of the
first ten terms of the Taylor Series expansion for the hyperbolic sine and hyperbolic cosine of an input x,
calling this VI as HypTaylor.VI
V. ASSESSMENT TASKS
1. What are the other Mathematics functions in LabVIEW apart from Trigonometric, Exponential and
Inverse Hyperbolic functions? Enumerate their functions and define when they can be used?
Page 27
ECE 100 Fundamentals of LabVIEW Programming
2. What is the importance of having Mathematical functions in creating a program using LabVIEW?
3. When using a trigonometric function such that you want to compute for the six trigonometric functions of
a given angle, how does LabVIEW interpret your input value?
4. Can we use the Mathematical functions of LabVIEW in the operation of an external device from the
platform itself? How and why?
VI. CONCLUSION
Page 28