Professional Documents
Culture Documents
acquire data from instruments or generate data using signal generation functions;
analyze data;
process data (e.g. filtering, transforms, etc.); and
control instruments and equipment.
Engineers and scientists use LabVIEW to bring information from the outside world into a computer using
data acquisition (DAQ) devices, process these data, and present these data to the user. Thus, LabVIEW
can be used to create virtual instruments (VI).
A virtual instrument is a computer program that imitates the functionality of the real-world physical
instrument. These virtual instruments can also take in external data and do something about these data,
just as how a standard instrument will work. These VIs however has the inherent advantage of being
flexible in terms of its use. Being virtual, these instruments functionalities are being programmed, and
hence can be changed whenever wanted and needed. In most cases, virtual instrumentation also results to
lower costs, as a single set of hardware (a DAQ device, a computer, and a software) can be configured to
perform many instrumentation tasks that require multiple physical instruments.
A LabVIEW program is also called a virtual instrument or VI.
Moreover, LabVIEW can also be used to simulate processes and control external instruments and
equipment. Thus, LabVIEW is very useful in the field of instrumentation and control.
Example 1.1
1. Open LabVIEW 2012 (via the desktop shortcut or the Start menu) and on the opening window, click
Help and choose Find Examples.
2. On the NI Example Finder window, choose the Search tab, type in Simulation Tank Level in the
Enter keyword(s) field and click Search. The Simulation Tank Level.vi must appear at the results
Basic LabVIEW Concepts
Page 1
5.
6.
7.
LabVIEW uses a very powerful graphical programming language which most LabVIEW users refer to as G
for graphical (the term is in reference to the C programming language). Programs are created in pictorial
form called a block diagram. One advantage it offers is that the developer does not need to know
syntactical details associated with text-based programming languages. The developer just needs to
connect functional nodes and how data flows from one node to another. However, those that are used to
working with text-based languages may need time to adjust to LabVIEWs style of programming (a personal
experience!).
Example 1.2
When you opened the Simulation Tank Level.vi, the front panel (or FP) appeared. To display the
source code or the block diagram (BD), press Ctrl+E. You need not know how does this BD works at this
point, but you can examine the composition of this BD by turning on the Context Help (via Ctrl+H), and
then hovering the mouse over the icons.
1. Find out what functional nodes do this BD contain.
2. What does the gray line that bounds the blocks represent?
Stop the VI by pressing the Abort execution icon on either the FP or the BD.
Drill Problems 1.1
1. Discuss what is meant by virtual instrumentation and how LabVIEW facilitates development of virtual
instruments. What are the advantages and disadvantages of using virtual instruments?
2. Explain what graphical programming is and how it accelerates development of systems.
3. Enumerate the uses and capabilities of LabVIEW.
Page 2
To start using LabVIEW, one can either choose to click the Blank VI, click on the File >> New VI menu or
press Ctrl+N to open a new, blank VI. This opens up two windows: the front panel (FP) and the block
diagram (BD), as shown in the figures below:
Page 3
Each window contains different set of menus. The menus pop out when you right-click on an empty field in
a window. We first discuss the front panel and its menus.
The front panel is the window through which the user interacts with the program. This is the window where
the user would input into the VI and also where the output is displayed. When you right-click on an empty
field in the front panel, the Controls palette appears as shown in the figure below.
Basic LabVIEW Concepts
Page 4
Figure 1. 4. The controls palette with the Modern controls palette selected.
This set of menus contains the controls and indicators for the front panel. In LabVIEW, controls are used
as inputs into the VI, while indicators are used as outputs of the VI. You can pin this menu to the front
panel by clicking the pin icon on the top left corner of the menu. You can unpin it by clicking the close
button at the top right corner of the menu when it is pinned. You can also click View >> Controls Palette
on the menu bar of the front panel so that the controls palette will appear. You can use the Search button
when finding for a front panel object. To get information about a certain object, press Ctrl+H and hover the
mouse over the object you wish to have more information about.
Controls are typically knobs, push buttons, dials, sliders, and strings. Controls simulate instrument input
devices and supply data to the block diagram of the VI. Indicators are typically graphs, charts, LEDs, and
status strings. Indicators simulate instrument output devices and display data the block diagram acquires or
generates.
Example 1.3
Find and place the following objects into the front panel, and find out some information about each.
1. Numerical control and numerical indicator.
2. Horizontal and vertical slide switches.
3. A square LED and round LED.
4. A knob and a dial.
5. A string and a ring control.
Page 5
After you create the front panel window, you add code using graphical representations of functions to
control the front panel objects. The block diagram window contains this graphical source code.
Basic LabVIEW Concepts
Page 6
This set of menu contains the functions, VIs and Express VIs. You then connect these nodes with wires so
that data may flow in and out of these nodes.
Objects on the front panel window appear as terminals on the block diagram. Terminals are entry and exit
ports that exchange information between the front panel and block diagram. Terminals are analogous to
parameters and constants in text-based programming languages. Types of terminals include control or
indicator terminals and node terminals.
Example 1.5
1. Place a numeric control and a knob in the front panel. Then observe the corresponding nodes that
have been placed in the block diagram.
2. Place a tank and a waveform chart in the front panel. Observe the difference between the
corresponding nodes of the controls and the indicators in the block diagram.
3. Place a color box control and a round LED indicator on the front panel. What can be said about the
corresponding nodes of the control and the indicator in the block diagram as compared to the first
Basic LabVIEW Concepts
Page 7
Figure 1.7 shows terminals in icon view. You can view these terminals without an icon by right-clicking on
the terminal icon at the block diagram and unchecking the View As Icon option. You can also automatically
place terminals on the block diagram without an icon by unchecking the Place front panel terminals as
icon option under the General options for the block diagram, which can be accessed via the Tools >>
Options menu and selecting Block Diagram under Category pane of the Options window that pops out.
Node terminals are terminal that do not appear as objects in the front panel, such as a constant.
Colors are used to represent what data types by default the nodes and the wires are carrying. Table 1.1
shows the common data types used in LabVIEW.
Page 8
The common rule of the thumb is that you can only connect nodes of the same color, otherwise, it may
result to a broken wire and a program error. But not all lead to errors. In some cases LabVIEW does some
conversions. This is the case when you have for example, a control node carrying an integer data is
connected to an indicator node carrying a double-precision floating-point number. In such case, the
conversion is indicated by a small red dot at the node, as shown in the figure below
You transfer data among block diagram objects through wires. Each wire has a single data source, but you
can wire it to many VIs and functions that read the data. Wires are different colors, styles, and thicknesses,
depending on their data types. Table 1.2 shows different wires and how are they identified depending on
their data type.
Page 9
Nodes are objects on the block diagram that have inputs and/or outputs and perform operations when a VI
runs. They are analogous to statements, operators, functions, and subroutines in text-based programming
languages. Nodes can be functions, subVIs, Express VIs, or structures. Structures are process control
elements, such as Case structures, For Loops, or While Loops.
Functions are the fundamental operating elements of LabVIEW. The Add and Subtract functions are
examples of function nodes. Functions do not have front panel windows or block diagram windows but do
have connector panes. Double-clicking a function only selects the function. A function has a pale yellow
background on its icon.
After you build a VI, you can use it in another VI. A VI called from the block diagram of another VI is called
a sub-VI. You can reuse a sub-VI in other VIs. To create a sub-VI, you need to build a connector pane and
create an icon. Sub-VIs are to be discussed in the next topic.
Express VIs are nodes that require minimal wiring because you configure them with dialog boxes. Use
Express VIs for common measurement tasks. Express VIs appear on the block diagram as expandable
nodes with icons surrounded by a blue field. Express VIs are to be discussed in a future topic.
The figure below shows the menu icons available for the block diagram.
Page 10
The Tools palette, which is common to both the front panel and block diagram, is shown in the figure
below. The Tools palette contains options for the cursor and is accessible thru the View >> Tools Palette.
You can also press Shift + Left click on an empty FP or BD to display the Tools palette temporarily.
Automatic Tool Selection Button this enables the cursor to change automatically as needed in
the block diagram. A green LED lit on indicates that this tool is enabled.
Operate Value Tool (finger) used to push buttons (to toggle a Boolean value, to select a menu
item, etc.
Position / Size / Select Tool (arrow) used to relocate and resize controls.
Edit Text Tool (A with cursor) used to enter text (on labels and string constants).
Connect Wire Tool (spool) used to connect wires between block outputs and inputs.
Object Shortcut Menu Tool (menu icon) opens a pop-up menu of options for controls and
programming blocks, the same as when an object or node is right-clicked.
Scroll Window Tool (cupped hand) used to drag a window (eg. to scroll to a hidden portion of a
large block diagram).
Set / Clear Breakpoint Tool (stop sign) used to set and clear breakpoints in the block diagram
which freezes the execution of the program to enable the programmer to see what is happening
within the program.
Probe Data Tool (probe symbol: yellow circle, arrow, P character) used to place probes in the
block diagram which shows the value in a wire as the program is executed.
Get Color Tool (dropper) used to set the current foreground and background colors
Page 11
Block diagram:
Page 12
Block diagram:
The front panel uses vertical pointer slider as controls and meters as indicators. Take note that the limit of
the Sum meter was changed to 20 because the limits of both the inputs are 10 and therefore the maximum
sum will be 20. In the block diagram, the control and indicator nodes are viewed as simple nodes to
conserve space.
Some instruments have warning indicators in their panels. We can add this up using a round LED (light
emitting diode) that lights up whenever the average of the two numbers reach 9. Edit Sum&Average2.vi
as shown below and save this as Sum&Average3.vi.
Page 13
Block diagram:
In this VI, annotations are added into the block diagram to provide information to the reader of the source
code. Labels are also displayed to the function nodes providing more readability to the block diagram.
Example 1.6
Build the VI AverageGrade.vi. The VI will have a front panel similar to the one below. The VI lists the
mathematics courses that an engineering student will take. The user is allowed to input numerical grades,
assuming that the input of the user will be just between 50 and 100. The VI averages the inputs and
displays the average grade rounded off to the nearest whole number using a gauge. A round LED is lit red
when the average is less than 75, and green when it is 75 or above.
Page 14
As another example, let us make a VI that would compute the mean, variance and standard deviation for a
set of five numbers. The variance for a population is computed as
=
1
N
1
N
where x is the ith data, is the population mean, and N is the number of data (population). To implement
this formula, we do the following steps:
1. Compute the population mean .
2. Subtract the population mean from the data and square their difference. This quantity is called the
squared error (Err ). Find the squared error for all the data.
3. Add all the error squared data. The sum is called the sum of squared error (SSE).
4. Divide the sum of squared error with the number of data. This quantity, which is a mean, is called
the mean squared error (MSE). This is also the variance of the data.
5. Take the square root of the variance. This quantity is now the standard deviation .
The StdDev1.vi shows how the five steps were implemented in LabVIEW.
Page 15
Block diagram:
Page 16
Block diagram:
Just like any other programming languages, you may encounter two types of errors or bugs in LabVIEW:
1. those errors or bugs that prevent the VI from running (similar to syntactical errors in text-based
programming languages); and
2. those errors or bugs that cause your VI to generate bad results or incorrect behavior.
In both cases, LabVIEW has tools to help you deal with these errors and bugs.
Basic LabVIEW Concepts
Page 17
The block diagram contains a broken wire because of a mismatch of data types or a loose,
unconnected end.
A required block diagram terminal is unwired.
A subVI is broken or you edited its connector pane after you placed its icon on the block diagram of
the VI.
A VI which cannot be run because of a programming error is indicated by a broken arrow as shown in the
figure 1.12.
To know what error has occurred, you can click the broken arrow which will display the error list.
Page 18
which shows that the error is caused by unconnected wires in the subVI. Correct it by making the proper
connections. With now a correct subVI, the VI is now executable. However, testing the VI with the same
sample values as before,
Page 19
Page 20
|x! x" |
Using LabVIEWs debugging tools, troubleshoot the VI which should give the correct t-score for the
following set of fifteen data:
Data set A: 26, 26, 26, 21, 18, 21, 19, 25, 23, 29, 22, 22, 24, 23, 22
Data set B: 18, 20, 20, 26, 17, 23, 20, 16, 21, 18, 21, 29, 20, 25, 19
Self Assessment: Rate your level of achievement for the following outcomes:
Cant do
Marginal
Acceptable Exceptional
Outcome
Performance Performance Performance
(0)
(1)
(2)
(3)
Build virtual instruments using arithmetic
and comparison functions in LabVIEW
Create a sub-VI out of a portion of, or all of,
a VI already made
Debug VIs using different debugging tools
Write your own thoughts and reflections on this topic.
e. The t-score is then computed as
t=
Trigonometric: functions such as sin, cos, tan, etc., are under this palette.
Exponential: functions such as exp, ln, log, etc., are under this palette.
Hyperbolic: functions such as sinh, cosh, tanh, etc., are under this palette.
Remember that trigonometric functions accept radians as inputs and inverse trigonometric functions return
angles in radians.
Statistical functions such as measures of central tendencies Mean, Median and Mode are found at the
Functions >> Mathematics >> Probrability and Statistics.
Complex number functions are found at Functions >> Numeric >> Complex. Some of these functions
include Complex Conjugate, Polar to Complex, Complex to Polar, Re/Im to Complex, and so on.
Basic LabVIEW Concepts
Page 21
Block diagram:
Example 1.8
Build a VI that would allow the input of a value from 1 to +1 and return the angle in degrees
corresponding to the inverse sine and inverse cosine of the input value.
The While-loop is a structure in LabVIEW that depends on the mode it is run, will do the following:
a. execute a code and stop when a certain condition is met; or
b. execute a code as long as a certain condition is being met.
Figure 1.16 shows the While-loop and the iteration and condition terminals. The iteration terminal is an
output node that keeps track of the number of times the While-loop has executed. The condition terminal is
Basic LabVIEW Concepts
Page 22
Figure 1. 17. The two modes of the condition terminal of the While-loop.
Data can be communicated in, out and around the loop using tunnels and shift registers. Tunnels allow the
passage of data in and out of the While-loop. Figure 1.18 shows an input node passing a scalar data into
the loop. Tunnels are automatically made when nodes outside the While-loop are connected to the nodes
inside the While-loop.
Tunnels are to be discussed in detail on the next article. For now, it is sufficient to know that the input
tunnel (a tunnel which inputs data into the while loop) and the output tunnel (a tunnel which passes data
from the while loop to another node outside) are non-indexed by default in While-loop.
The shift register stores the result of the current iteration and passes it to the next iteration for use. Shift
register comes in pair, that is, an output shift register is paired with an input shift register. The shift register
can have an initial value by passing a data into the input shift register. This initial value is the value used by
Basic LabVIEW Concepts
Page 23
The while loop structure, as well as other execution structures in LabVIEW will be discussed in more detail
in future topics; for now, we cover the basic things one must know when using a While-loop. The next
example uses a While-loop to implement a numerical solution called the Newton-Raphson method.
Example 1.9
Given the following equations for a catenary
s = a sinh
L
a
where s is half of the rope length a is the parameter related to the mass of the rope and the acceleration
due to gravity, and L is half the distance of the posts supporting the rope. The sag of the rope is given as
L
d = a 6cosh 18
a
Given s = 58.75 and L = 50, find d using LabVIEW.
Catenary.vi
Front panel:
Page 24
Example 1.10
Use the statistical functions of LabVIEW to generate the following
a. an array of 100 uniformly distributed random numbers between 0 and 1.
b. an array of 100 uniformly distributed random numbers between 1 and 1.
c. an array of 100 normally distributed random numbers.
d. an array of 100 normally distributed random numbers with a mean of 2.8 and a standard deviation
of 2.5.
In all of the cases, find the mean, standard deviation, variance, skewness and root mean square (RMS),
and then using the Histogram.vi, plot the histograms of each set of random numbers.
Page 25
Block diagram:
Page 26
This time, use only two indicators and use complex functions to build QuadraticEquationSolver2.vi, with
the front panel looking like the one below:
Hint: Set the indicators to display numbers using complex double precision floating-point format.
Drill Problems 1.4
1. Using the Eulers formula, the trigonometric and hyperbolic functions for the complex number z = x +
jy can be established, and will show that the two functions are actually related thru the complex
number. Derive a formula to find the following: sinh x + jy ; cosh x + jy ; sin x + jy and
cos x + jy , and then create a VI that would numerically prove your derivations. Name the VI as
TrigAndHyp.vi.
2. De Moivres theorem is a formula that is useful in finding the power and roots of complex numbers. It is
stated as
z = = x + jy = = >r cos + j sin @= = r = cos n + j sin n
For fractional n, the right-hand side expression is multivalued and becomes
+ 2k
+ 2k
+ j sin
8
z /= = x + jy /= = >r cos + j sin @ /= = r /= 6cos
n
n
where k = 0,1,2 n 1. Build a VI that computes the fourth root of a complex number. The user is
allowed to input numbers: the real part and the imaginary part of the complex number z. The VI must
solve the four roots of the number z, in complex number form. Implement the VI in two ways:
a. using trigonometric functions (name the VI as DeMoivreTrig.vi), and
b. using complex number functions (name the VI as DeMoivreComplex.vi)
3. The Taylor series expansion for the hyperbolic sine function is given as
K
xE xG xH
x =J
sinh x = x + + + + =
3! 5! 7!
2n + 1 !
= L
Page 27
= L
x =
2n !
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 Use While-loop, and follow the following steps:
1. Input x.
2. For the first iteration (i = 0), compute the first term of the series.
3. Store the first term into the shift register.
4. For the second iteration (i = 1), compute the second term of the series. Add this to the first term
stored in the shift register and save their sum into the shift register.
5. Repeat step 4 until the number of iterations reaches 10 (i = 9).
6. Display the sum.
For comparison, compute the hyperbolic sine and hyperbolic cosine. Notice that as x grows larger, the
discrepancy between the Taylor series generated and the function generated values grows larger.
4. Simulate the following random events by creating a VI :
a. Tossing of coins. The output should either be a Head or a Tail. Call the VI as TossCoin.vi.
b. Tossing of a dice. The output should be an integer number from 1 to 6. Call the VI as Dice.vi.
c. Selecting six numbers out of 55 numbers from 1 to 55. The output is an array of six numbers, like
picking six numbers to place a bet on the lottery. Call the VI as Lotto655.vi. Note that the VI might
return repeated numbers in an array. This will be okay for now.
5. Determine the lowest positive root of f x = 8eOP sin x 1
a. using Newton-Raphson method.
b. using fixed-point iteration. Use the fixed-point iteration formula x J = x + 8eOPQ sin x 1.
Determine the root correct to three decimal places. Also, determine how many iterations are required
for each method. Which method arrives at the answer faster?
Self Assessment: Rate your level of achievement for the following outcomes:
Cant do
Marginal
Acceptable Exceptional
Outcome
Performance Performance Performance
(0)
(1)
(2)
(3)
Use LabVIEWs different elementary math,
statistical and complex number functions
Use while loops with shift register and
tunnels with different modes
Write your own thoughts and reflections on this topic.
1.5. Matrices and arrays in LabVIEW
At the end of this lesson, the student shall be able to:
a. understand how LabVIEW groups data into a single container;
b. generate arrays and matrices using While-loop and For-loop; and
c. operate and manipulate matrices and arrays.
Page 28
Cluster a cluster is a grouping of potentially different data types; for example, information about
an individual that includes:
o Name (string)
o Birthdate (date/time)
o Age (integer numeric)
o Height and weight (floating-point numeric)
o Photograph (image)
can be stored on a single container called a cluster. We will deal with clusters later on.
Array an array is a group of data with the same data type. Arrays can have as many dimensions.
The list of scores in a quiz of a class of 30 is a one-dimensional array (can be a row vector or a
column vector). If the list contains not only the scores of a particular class, but of all classes who
took the same quiz, the list is a two-dimensional array.
Matrix a matrix is a two-dimensional array which only contains numeric data. A two-dimensional
array whose elements are all numeric can be considered a matrix, however, LabVIEW
differentiates the two by having array operations and matrix math operations. For most cases, both
operations have the same meaning and hence can be used interchangeably.
In this chapter, we will deal mostly with array manipulations and operations, which also apply to matrix
manipulations and operations. We will just mention specific cases when needed.
Example 1.12
Create an array control, a matrix control, an array indicator and a matrix indicator in the front panel.
The next example shows how a While-loop can be used to create a two-dimensional array.
Example 1.13
(a) Build a 10 5 two-dimensional array whose elements are uniformly distributed random numbers
between 0 and 30 rounded off as integers.
(b) Build a 5 10 two-dimensional array whose elements are uniformly distributed random numbers
between 0 and 30 rounded off as integers.
(c) Show how the number of columns and rows of the two-dimensional array can be controlled by the user.
Use While-loops in (a) and (b).
Page 29
Block Diagram:
Another structure that can be used in the generation of arrays is the For-loop. The For-loop executes the
code inside the structure for a number of times. A condition can also stop a For-loop from running by
inserting a condition terminal inside a For-loop. The For-loop stops when this condition is met, or when
the number of iterations has been reached, whichever comes first.
Data in and out of the For-loop can also be transferred via data tunnels. These tunnels are basically the
same as that of While-loop. The basic difference only is that the default tunnel mode for While-loop is the
latest value, while that for the For-loop, the default is indexing.
Example 1.14
(a) Build a 10 5 two-dimensional array whose elements are uniformly distributed random numbers
between 0 and 30 rounded off as integers.
(b) Build a 5 10 two-dimensional array whose elements are uniformly distributed random numbers
between 0 and 30 rounded off as integers.
(c) Show how the number of columns and rows of the two-dimensional array can be controlled by the user.
Use For-loops in (a) and (b).
Page 30
Block Diagram:
Another mode for the tunnel is the concatenating mode, which concatenates the recently generated array
into the previously generated array. The use of such mode can be demonstrated using the following
example.
Example 1.15
Given an array >1 2 3 4@, produce the following arrays:
1 2 3 4
(a) S1 2 3 4T
1 2 3 4
(b) >1 2 3 4 1 2 3 4 1 2 3 4@
Page 31
Block diagram:
Operations on arrays and matrices. Arrays and matrices can be operated on arithmetically just like
scalars.
Example 1.16
Through an example VI, show how arithmetic operations work for scalars and arrays.
AddingArrays.vi
Front panel:
Page 32
Matrices generally follow the same rules as that of array operation, except for multiplication and division.
Example 1.17
Through a VI, demonstrate the difference between array multiplication and matrix multiplication.
ArrayMultVsMatrixMult.vi
Front panel:
Page 33
Example 1.18
Re-implement the VI for computing the standard deviation, improving what StdDev1.vi and StdDev2.vi can
do. This time, StdDev3.vi should be able to compute the standard deviation for any number of data.
StdDev3.vi
Front panel
Block Diagram
Page 34
Example 1.19
Given the following arrays,
do the following:
(a) Determine the size of any one of these arrays.
(b) Create a 2D array whose elements of the first, second and third rows are the elements of 1D Array 1,
1D Array 2, and 1D Array 3, respectively. Determine the size of this 2D Array.
(c) Create a 2D array whose elements of the first, second and third columns are the elements of 1D Array
1, 1D Array 2, and 1D Array 3, respectively. Determine the size of this 2D Array.
(d) Extract the fourth, sixth and tenth element of 1D Array 1.
(e) Extract the elements at the fifth row of 2D Array in (b). Also, extract the elements of the second column
of 2D Array.
Basic LabVIEW Concepts
Page 35
Block diagram:
Matrices can also be manipulated using functions under the Matrix palette. The students are expected to
try on these functions and see how they work.
Basic LabVIEW Concepts
Page 36
A Z BZY
MatrixMultiplicationViaArrays.vi
Front panel
Block diagram
Page 37
Page 38
These chart and graph indicators are available on the controls palette.
Waveform chart and waveform graphs differ by the manner they can display and update data.
A waveform chart remembers and displays a certain number of points by storing these points in a buffer.
When the buffer gets full, the chart starts overwriting the old values with the new ones. When new data
points become available, they are appended to the old ones. Waveform charts are used to display real-time
data points, though it also accepts arrays and displays the points all at once.
A waveform graph however, accepts array as an input and displays these as data points all at once. It
does not accept single value points. It is assumed that the points in the array are equally spaced when they
are accepted as an input to a waveform graph.
The following example illustrates the difference between a waveform chart and a waveform graph.
Example 1.21
Plot the function y = sin x for 0 x 2 using a waveform chart and a waveform graph.
Page 39
Block diagram
Strip Chart: This mode has a scrolling display that is similar to a paper tape strip chart recorder.
This mode first plots values from left to right. From here, it continues to plot new points at the
rightmost point and shifts old values to the left.
Scope Chart: This mode has a retracing display similar to an oscilloscope. As it receives each new
value, it plots the value to the right of the last value. When the plot reaches the right border of the
plotting area, it erases the plot and begins plotting again from the left border.
Page 40
Sweep Chart: This mode acts much like the scope chart, but the plot is not erased when the plot
hits the right border. Instead, a moving vertical line marks the beginning of new data and moves
across the display from left to right as it adds new data.
Example 1.22
Explore the difference between the three update modes of waveform chart.
The waveform chart and the waveform graph can be configured using the Properties dialog box.
Example 1.23
Show how charts and graphs can be configured using the Properties dialog box.
ConfiguringChartAndGraph.vi
Front panel:
Example 1.24
Plot the sine wave y = sin x and the cosine wave y = cos x for 0 x 2 on the same waveform
chart and graph.
Page 41
Block diagram:
In the foregoing discussions, the data plotted mostly are time-based data, that is, the x-axis was dedicated
to time. This is not really the case however. For waveform charts and waveform graphs, we assume that
the variable in x-axis is equally spaced. So if you are to plot a data, not necessarily time-based data, but
the data points are generated with equal spacing, waveform charts and waveform graphs provide a good
way to plot these data points. For unequally spaced x-axis, XY Graphs can be used.
Page 42
Block diagram
Example 1.25
Use graphical method to find the approximate roots of the equation x E 9.4x + 22.95x 10.602 =
0. The roots of this equation are the values of x which satisfy the equation. Note that since the degree of
the polynomial in the equation is 3, there will be three roots.
Page 43
Block diagram
LabVIEW also has tools for plotting in three dimensional. In the first example, a surface plot is generated
using parametric values.
Example 1.26
Create a surface plot for a torus. A torus is a ring with two parameters: the distance between the center of
the torus to the center of the tube R, and the radius of the tube r, as shown in the figure below.
Page 44
Block diagram
Page 45
PQ
data below which tries to determine if there is a relationship between the length of the tail (TLength)
of a fox in inches to the weight (Weight) of the fox in pounds.
Page 46
Page 47