Professional Documents
Culture Documents
GRAPHING IN LABVIEW
Activity No. 6
I. INTENDED LEARNING OUTCOMES
At the end of this activity, the student shall be able to:
1. Understand the difference between LabVIEW’s charts and grahs.
2. Display data and waveforms into a bar and charts.
3. Configure charts and graphs for data presentation.
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.
Page 44
ECE 100 Fundamentals of LabVIEW Programming
• 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.
III. LEARNING ACTIVITIES
1. You will be plotting a sinusoidal waveform y = sin sin x f or 0≤x≤2π using a Waveform Chart and a
Waveform Graph. Create a Front Panel and Block Diagram as shown. Save your VI as Act6_1_1.VI
Page 45
ECE 100 Fundamentals of LabVIEW Programming
To access Waveform Chart, right click anywhere in Front Panel and choose
Controls Modern Graph Waveform Chart.
To access Waveform Graph, right click anywhere in Front Panel and choose
Controls Modern Graph Waveform Graph. Provide also a Numerical Indicator above the displays.
3. On the Block diagram, drag and drop a For-loop structure and put inside the following objects: Wait
until ms set to 25, sin function, Waveform Chart, and the Numeric Indicator.
4. Outside the For-loop structure, put a Multiply function on the Iteration condition, N by dividing 200 to
a constant pi. To put a constant pi, right click anywhere in the Block Diagram and choose
Functions Programming Numeric Math Constants Pi.
Question: Why is that the iteration condition is set to 200×pi? What does it do in the program?
The iteration condition is set to 200(pi) is due to the reason that it is the equation that will provide a
full-wave that can be seen on the waveform graph. The 200xpi is for the slope of the graph so that the VI
shows the curve with respect with its’ x and y axis 200xpi because it is a value that can be more
appropriate to the VI so that the VI run with no delusion and entangled graph lines.
Question: What is the purpose of Wait until ms function inside the For-loop structure?
The Wait until (ms) function adds the wait time to the code execution time. This can cause a
problem if code execution time is variable. The Wait until (ms) function waits until the millisecond counter
counts to an amount equal to the input you specify. This function guarantees that the loop execution rate
is at least the amount of the input you specify. The Time Delay Express VI, behaves similar to the Wait
(ms) function with the addition of built-in error clusters.
Question: What will happen if you put the Waveform Graph inside a For-loop structure and connect
it to the output terminal of the sin function? Why does that happen?
After putting the waveform graph inside a For-loop structure and connecting it to the output terminal
of the sin function, I was about to run the Vi but the program does allow. If solely basing on the Body
Diagram, one could already tell what is the error because the line has a problem which causes it to not
connect with each other. Another way to find the error would be by clicking View -> Error List which will
gprovide you an answer of “You have connected two terminals of different types.”
Using the Strip Chart, it forms a normal wave from positive 1 to negative 1 forming a full wave
and it stops after the duration of the run button.
Using the Scope Chart, it also forms a wave, but after reaching both the positive 1 and negative
1, it comes back at the middle where 0 lies and it stops right there not forming another round of wave.
Using the Sweep Chart, its like how the Scope Chart mode works but there is a straight red line wherein
it sweeps away the previous waveform and creating a new one both both the positive and negative sides.
These updates are not available for Waveform Graph, as it displays the waveform as a whole or displays
the points all at once, unlike in waveform chart where it displays points in a buffer creating a slow motion
waveform.
4. Explore the Property dialog box of the Charts and Graphs and customize your plots.
SCREEN-CAPTURE your graphs and charts and include it in your activity report.
Question: How do we visually customize our charts and graphs to make it presentable? Explain it
in a procedural manner.
e can make it more presentable by right-clicking the Waveform Chart and the
W
Waveform Graph. After that we will click Properties → Plots, and we can select what
type of line to use, thickness and the color. For the type of line, it is more presentable
if we use normal line. When it comes to thickness it is better if it is thick. Lastly, for the
color, we used vibrant colors as it a good tandem for the black background that will
enhance the color's beauty.
ACTIVITY 6.3:
MULTIPLE PLOTS
1. Create a VI with
the following Front
Page 47
ECE 100 Fundamentals of LabVIEW Programming
Panel and Block Diagram as shown. Save your VI as Act6_3_1.VI
The FP shows graphical display of sin(x) and cos(x).
Question: Explain in a systematic manner how did you come up with the Front panel and Block
Diagram shown above. Do a mini-procedure on how you obtain the plots above?
Step 1: Put a "For Loop" in the Block Diagram.
Step 2: Put the Waveform Chart and Graph in the Front Panel (Right Click -->Waveform --> Click the
Waveform Chart and Graph).
Step 3: Put 2 numeric indicators then rename it as sine(x) and cosine(x).
Step 4: Put the needed operation functions (multiply,divide and constants) and connect it to its
designated place.
Step 5: Arrange the Sine and Cosine function inside the For Loop.
Step 6: Run the VI file
Question: What function did you use to superimpose two plots in a single chart or graph? Explain
this function.
To superimpose the two plots in a single chart or graph, we used the Cluster Bundle Function and the
Build Array Function.
Page 48
ECE 100 Fundamentals of LabVIEW Programming
Build Array Function - operates in one of two modes depending on whether you select Concatenate
inputs from the shortcut menu. The function appends all inputs in order, forming an output array of the
same dimensionality as the array input.
1. Create a VI that would plot the following functions into a chart and a graph: the exponential function y =
ex , the logarithmic function y = ln x, hyperbolic cosine function y = cosh x and the cosine
function y = cos x for 0 ≤ x ≤ 5. Choose appropriate spacing to ensure smooth plot.
Choose the appropriate scaling for the x and y axes so that the user will have an idea
on how the function behaves as x gets larger. Make sure also that the user will be able
to discern which plot is which. Finally, choose which is the better tool to plot such
functions so that the user will be able to use the plots for better understanding of the
behavior of the function. Call this VI as FunctionPlotter.vi.
Machine Problem 1: FUNCTION PLATTER
2. (a) Generate a Gaussian distributed random number with a mean of 10 and a standard deviation of 2.
Your VI would only stop generating a random number when a Stop button is pressed. The VI should only
generate 100 data points per second. Plot the random numbers as they are generated and after pressing
the Stop button. Name the VI as WhiteNoise.vi. (b) A moving average filter is a kind of filter which aims to
smoothen out variations in signals. It works in the following manner: the current value and a number of
previous values are averaged to generate a new value. The number of values to be generated depends on
the window size of the filter. If for example, the window size is 10, then the current value plus 9 previous
values of the input signal are averaged. With this, create a moving average filter for the input signal
generated in part (a). The window size of the moving average filter is 5. Plot the input signal and the filtered
Page 49
ECE 100 Fundamentals of LabVIEW Programming
signal on the same set of axes. The VI should stop when a Stop button is pressed. Call this VI as the
MovingAverageFilter.vi. (Hint: Use shift registers.)
Machine Problem 2: WHITENOISE & MOVING AVERAGE FILTER
V. ASSESSMENT TASKS
1. What are the differences between a Waveform Graph and a Waveform Chart?
A Waveform Graph accepts arrays of data in various forms, e.g. array, waveform, or dynamic data. It
then plots all the received points at once. It does not accept single point values. When an array of points
is wired to a waveform graph, it assumes the points are equally spaced out. By default, the starting X
value and step size (t0 and dt) are 0 and 1 respectively. This can be changed in the properties of the
graph or using property nodes while a Waveform Chart remembers and displays a certain number of
points by storing them in a buffer. When the buffer gets full, the chart starts overwriting the oldest points
with new ones. As the data points become available, the Waveform Chart displays received data in
addition to already existing points. You can write single or multiple data points to it at once. If we wire an
array of points to the chart, it will append those points to the existing ones. You can display multiple plots
on the same chart by wiring in a cluster of points or a 2D array containing waveform or dynamic data for
each plot. For example, if you wire in a cluster of three points, one point will be added to each of the
three plots.
2. How do you differentiate Strip, Scope and Sweep chart update mode of a Waveform Chart?
Page 50
ECE 100 Fundamentals of LabVIEW Programming
Strip Chart: This mode has a scrolling display that forms a simple or a common waveform. As it
receives each new value, it plots the value at the right margin, 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.
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 red line marks the beginning of new data
and moves across the display from left to right as if it sweeps the previous waveform as it adds new data.
4. Upon exploring the LabVIEW environment for Graphing, how do we do Surface and 3D plots?
You can use the 3D Surface, 3D Parametric, and 3D Curve graphs in conjunctions with the 3D Graph
Properties (Graph, Plots, Axis, Value Pairs, Format, Cursors) to plot curves and surfaces. A curve
contains individual points on the graph, each point having an x,y, and z coordinates. A curve is ideal for
visualizing the path of a moving object, such the trajectory path of a ball.
VI. CONCLUSION
In conducting this activity, we learned how to understand the difference between LabVIEW's charts and
graphs. To display data and waveforms into a bar and charts representation. Easily configure charts and
graphs for data presentation. Using the charts and graphs function in LabVIEW can help in condensing
large amounts of information into easy-to understand formats that clearly and effectively communicate
important points that can result in an output in the VI.
Page 51